Address gallery URI path edge case

When reading the URI path of eHentai galleries, we split on /. This results in 4-5 fields, the 1st being empty. Whether or not the path ends with the delimiter determines this.

We currently assume that there will always be 5 fields, making use of list deconstruction like so:

_, route, gallery_id, gallery_token, _ = path

This results in an error if there aren't. ~luma_inhibitor wanted this for readability, favoring it over using list index references. I'd realised this edge case when implemented it, but didn't think we'd run into it since page navigation always produced URIs that had the ending slash in my testing. They were able to hit this edge case somehow, unfortunately.

If there's a way we can preserve readability, but be flexible with reading path fields, that'd be ideal. Otherwise, assigning the list indexes to some named variables without list deconstruction is fine.

Assigned to
2 years ago
2 years ago
bug previews

~erin 2 years ago

The nHentai parser is similarly impacted. I think its chrome browser that strips the trailing / from URIs copied from the address bar.

~erin 2 years ago

Lily helped with this fix. It will be included with code for #67

Register here or Log in to comment, or comment via email.