Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow servers that return html with absolute links #115

Closed
wants to merge 1 commit into from

Conversation

bikemike
Copy link
Contributor

@bikemike bikemike commented Mar 9, 2023

Convert absolute links to relative links

Convert absolute links to relative links
@fangfufu
Copy link
Owner

fangfufu commented Mar 9, 2023

This PR could help solving,
#107

Have you thought about the approach taken here - extract the full link? I am thinking of simply allowing absolute link, rather than converting to relative link.
2ef9154?diff=split#r103774983

@bikemike
Copy link
Contributor Author

At first I thought the best way would be to check the absolute links against the parent directory path. If the links contained the parent directory path, then remove that portion. If the resulting relative link did not contain any more slashes then it is valid, otherwise it points to a different folder location and should be ignored.

But I didn't see a quick method to get the parent directory path in HTML_to_LinkTable so I just made the links relative assuming that the server wasn't returning links to other directory locations.

Using the basename function might be a simpler solution that what I've done but at the time I initially wrote this code I think I thought that directories needed the "/" on the end. The basename function removes that last "/".

If you want to allow absolute links then linkname_to_LinkType will need a small change as it only allows relative links.

@fangfufu
Copy link
Owner

@bikemike , I decided to merge in #121, so I am closing this. Thanks for trying to help though!

@fangfufu fangfufu closed this Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants