Fix wallabag directories' trailing slashes#14001
Conversation
|
I've tested on my Kobo, there it works |
|
I'm not entirely sure if that makes sense in the context of the rest of the code. I think that everywhere else it's |
|
Usually we store dir paths without the trailing slash. |
|
In that case @harmtemolder would you mind changing it to add the |
|
Sure thing. I'm all for staying congruent with code elsewhere. We still need the migration though, because when using the default before (instead of manually selecting a directory) this would include the trailing slash. I believe I've now rewritten everything to not store trailing slashes in settings, and to concatenate it in when using |
| local wb_lua = DataStorage:getSettingsDir() .. "/wallabag.lua" | ||
| if lfs.attributes(wb_lua, "mode") == "file" then | ||
| local wb_settings = LuaSettings:open(wb_lua) | ||
| wb_settings:readSetting("wallabag") |
There was a problem hiding this comment.
If you do
local settings = wb_settings:readSetting("wallabag")you can use shorter settings.directory and avoid saveSettings later.
| local wb_settings = LuaSettings:open(wb_lua) | ||
| wb_settings:readSetting("wallabag") | ||
|
|
||
| if wb_settings.data.wallabag.directory:sub(-1) == "/" then |
There was a problem hiding this comment.
I think the check is not needed, gsub does all the work.
Unlike the reverse I don't think that's actually problematic other than looking a bit silly? Don't just take my word for it of course, but: |
|
I found
And no migration is needed. |
Fixes #13987
Also added to
onetime_migration.luato add the trailing slashes so users do not need to manually choose the dir again for this fix to apply.This change is