-
-
Notifications
You must be signed in to change notification settings - Fork 71
Feat: open files with relative path #232
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
Conversation
Now we can open files directly by running `amfora file.gmi` rather than doing `amfora file:///absolute/path/to/file.gmi`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this PR.
Checking for specific protocols as you have done will not work. For example, you have missed https://
. But more importantly, the user could be using any protocol at all, thanks to the features Amfora has like proxying.
A better solution is to check for ://
. If that's missing, then check if the file exists, just passing the argument as is. Absolute or relative paths can be handled the same, and so it doesn't need to be checked for that. If the file exists, convert to a file://
URL and pass it along. If the file doesn't exist, pass it along unchanged, as it's maybe a domain like geminispace.info
.
Let me know when you've made these changes (by comment or requesting a review), and I'll take a look again.
Sorry for the delay, I couldn't get any spare time. This might take some time if that is okay. |
No worries. Just let me know if you can't continue with this later for whatever reason, and I can take it over. |
Local files can now be loaded by relative path, rather than the whole path preceded by the `file://` scheme indicator. It first checks whether or not the requested URL has a scheme (by checking for `://` in the URL), but also allows making intention known by specifying `./` or `../` before the URL, closely matching the behavior of Firefox. This borrows code from @singalhimanshu's PR (makew0rld#232). Resolves makew0rld#231
Local files can now be loaded by relative path, rather than the whole path preceded by the `file://` scheme indicator. It first checks whether or not the requested URL has a scheme (by checking for `://` in the URL). If not, it checks to see if the file exists before opening. It also allows making intention known by specifying `./` or `../` before the URL, closely matching the behavior of Firefox. This borrows code from @singalhimanshu's PR (makew0rld#232). Resolves makew0rld#231
Local files can now be loaded by relative path, rather than the whole path preceded by the `file://` scheme indicator. It first checks whether or not the requested URL has a scheme (by checking for `://` in the URL). If not, it checks to see if the file exists before opening. It also allows making intention known by specifying `./` or `../` before the URL, closely matching the behavior of Firefox. This borrows code from @singalhimanshu's PR (makew0rld#232). Resolves makew0rld#231
Fixed by #257. Thanks for your work though! |
Now we can open files directly by running
amfora file.gmi
rather thandoing
amfora file:///absolute/path/to/file.gmi
Solve #231