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

handle file:// protocol URI scheme #5297

Merged
merged 1 commit into from Sep 1, 2019

Conversation

@contrun
Copy link
Contributor

commented Sep 1, 2019

This patch only handles part of file URI scheme defined in rfc 8089, i.e., it currently only handles file://ABSOLUTE_PATH.

@contrun contrun force-pushed the contrun:handleFileURI branch from 189fdf5 to 23a18a0 Sep 1, 2019

@Frenzie
Copy link
Member

left a comment

Btw, how is this triggered precisely? Not an objection, just curious.

reader.lua Outdated Show resolved Hide resolved
reader.lua Outdated
@@ -201,10 +201,27 @@ SettingsMigration:migrateSettings(G_reader_settings)

local exit_code

local function getPathFromURI(str)
local hex_to_char = function(x)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Sep 1, 2019

Member
Suggested change
local hex_to_char = function(x)
local hexToChar = function(x)

That's in our style guide to distinguish functions/methods from variables.

@Frenzie Frenzie added this to the 2019.09 milestone Sep 1, 2019

@contrun

This comment has been minimized.

Copy link
Contributor Author

commented Sep 1, 2019

You mean how I came to the thought of handling file://?
I was using mimeo and fzf to open pdf files quickly. mimeo automatically converts file paths to file:// format. So I was not able to view pdf files as expected.

@contrun contrun force-pushed the contrun:handleFileURI branch from 23a18a0 to 3eb5103 Sep 1, 2019

if str:sub(1, #prefix) ~= prefix then
return str
end
return unescape(str):sub(#prefix+1)

This comment has been minimized.

Copy link
@Frenzie

Frenzie Sep 1, 2019

Member

What if the input is just file://?

This comment has been minimized.

Copy link
@contrun

contrun Sep 1, 2019

Author Contributor

never thought about that. Corrected it.

@contrun contrun force-pushed the contrun:handleFileURI branch from 3eb5103 to e3b4560 Sep 1, 2019

@Frenzie

This comment has been minimized.

Copy link
Member

commented Sep 1, 2019

Right, I was wondering if it came up in regular use, semi-advanced use (e.g., copying the URL from a browser that opens PDFs) or in a completely artificial manner.

@Frenzie Frenzie added the enhancement label Sep 1, 2019

@Frenzie Frenzie merged commit 0a1a407 into koreader:master Sep 1, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details
@Frenzie

This comment has been minimized.

Copy link
Member

commented Sep 1, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.