mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-25 09:06:02 +03:00
[GH-ISSUE #591] Bugfix: media links are incorrect when the trailing slash is missing #366
Labels
No labels
expected: maybe someday
expected: next release
expected: release after next
expected: unlikely unless contributed
good first ticket
help wanted
pull-request
scope: all users
scope: windows users
size: easy
size: hard
size: medium
size: medium
status: backlog
status: blocked
status: done
status: idea-phase
status: needs followup
status: wip
status: wontfix
touches: API/CLI/Spec
touches: configuration
touches: data/schema/architecture
touches: dependencies/packaging
touches: docs
touches: js
touches: views/replayers/html/css
why: correctness
why: functionality
why: performance
why: security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ArchiveBox#366
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @berezovskyi on GitHub (Dec 24, 2020).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/591
Describe the bug
When I navigate to the media folder from
/admin/core/snapshot/as opposed to a single archived item, I am redirected to/mediafolder and not/media/. The one without a slash generates faulty links.Steps to reproduce
/archive/1608817286.406686/media/introduction%20to%20using%20fish%20shell-w4C9oswxUM8.webm/archive/1608817286.406686/introduction%20to%20using%20fish%20shell-w4C9oswxUM8.webmScreenshots or log output
Software versions
@berezovskyi commented on GitHub (Dec 24, 2020):
This is my first time looking at the archivebox codebase but I have two possible fix suggestions:
github.com/ArchiveBox/ArchiveBox@096749da87/archivebox/index/html.py (L124)/media/is prepended atgithub.com/ArchiveBox/ArchiveBox@096749da87/archivebox/index/html.py (L66)but only if rendering is done from the page without a slashI guess 1st and 3rd options would be easiest and would make most sense. Thank you for the archivebox, Merry Christmas and happy holidays!
@cdvv7788 commented on GitHub (Dec 24, 2020):
This is related to this: https://github.com/ArchiveBox/ArchiveBox/issues/487
I will give it a check next week.
@rpdillon commented on GitHub (Jan 22, 2021):
Just picked up ArchiveBox for the first time this past week, and I noticed the media links from the main index don't have a trailing slash, so the relative links in the directory all return a 404. I thought the extraction was broken, but as I started digging, I discovered it's just an issue of the trailing slash, so now I'm manually adding the trailing slash to access media links.
I took a look at the code, at it looks like the trailing slash could be added in schema.py:429, but I haven't yet vetted where else that value might be used, so I'm not sure if that's the correct fix.
@pirate commented on GitHub (Jan 25, 2021):
@rpdillon are you referring to the static main index
./data/index.html, the django public main index/public, the admin main index/admin/core/snapshot/? The trailing slash behavior differs between them for an important reasons, adding a trailing slash in the code might fix one index but subtly break the other 2/3 cases. It's already been added and removed several times because of the differences between the methods, and doing so has often broken things in the past.@rpdillon commented on GitHub (Jan 26, 2021):
Heya @pirate! Thanks for alerting me to these three cases! Only one has the trailing slash in my instance running version 0.5.3:
./data/index.html/public/admin/core/snapshotSo your suspicion seems correct: if we change schema.py it'll break one to fix the others. I'm happy to take a look over the next couple of days in the evenings to see if I can put up a PR to address this, I'll just have to set up a dev env for the project, so I thought I'd check here first in case it was an easier fix.
@pirate commented on GitHub (Jan 30, 2021):
I think I fixed this in v0.5.4, give it a try: