Skip to content

feat(cloudstorage/webdav): Show 'file size' property in WebDAV#13371

Merged
Frenzie merged 5 commits into
koreader:masterfrom
Linus045:feature_webdav_filesize
Mar 11, 2025
Merged

feat(cloudstorage/webdav): Show 'file size' property in WebDAV#13371
Frenzie merged 5 commits into
koreader:masterfrom
Linus045:feature_webdav_filesize

Conversation

@Linus045

@Linus045 Linus045 commented Mar 6, 2025

Copy link
Copy Markdown
Contributor

This PR adds a 'file size' property to the item dialog when selecting an item using Webdav Cloudstorage (see picture).

  • 1) I sadly don't have an FTP/Dropbox/etc. setup to test/implement the other providers, so if someone else could at least make sure it does not cause crashes/other issues I would appreciate it, although the new field should not really affect these providers.

  • 2) I was not sure what to show if the file size can't be queried (also not entirely sure when this would even be the case) so I'm just showing "N/A". If this causes problems with translations I'm happy to adjust it.

Default menu when file size is available:

Forcing the 'item.filesize' to be nil to display 'N/A':


This change is Reviewable

@hius07

hius07 commented Mar 6, 2025

Copy link
Copy Markdown
Member

Dropbox list shows the size in the right column. Can it be the same for WebDAV?

d

@Linus045

Linus045 commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

I'm completely new to this codebase, this is my first PR here, so I wasn't aware this was even possible.
I've added the file size to the right of the item and kept the file size in the item dialog as well.

I've also used the gettext()/_() method to translate the "N/A" string, which I've seen used elsewhere already.

Note: I deliberately kept the filesize variable as an integer in case it is needed later and moved the transformation to the human-readable string into the createTitle.

@hius07

hius07 commented Mar 6, 2025

Copy link
Copy Markdown
Member

I think it's redundant in the dialog.

@Linus045

Linus045 commented Mar 6, 2025

Copy link
Copy Markdown
Contributor Author

Well, personally, I like to have the information in that dialog as well, that way I don't need to close the dialog if I need to see the file size because of the menu blocking the view.
Also it makes it easier to read on smaller eReaders because the listview's right text is rather small.

My only real concern would be that the textbox gets too big (due to the additional line breaks) and might cause problems on certain eReaders.

Therefore maybe we can just append it at the end of the filename instead.
This keeps the dialog small and shows the file size.
What do you think of this idea?
e.g.

If you also don't like this approach I'm happy to remove it, but I don't really see any reason to not just show it in the dialog as well.

@Linus045 Linus045 changed the title feat(cloudstorage/webdav): Adds 'file size' property to item popup feat(cloudstorage/webdav): Show 'file size' property in WebDAV Mar 6, 2025
@mergen3107

Copy link
Copy Markdown
Contributor

I vote for having it in the dialog as well - as a reminder right before you hit Download button

@hius07

hius07 commented Mar 6, 2025

Copy link
Copy Markdown
Member

I don't mind. Separate lines for filesize looks better for me.

…e instead in item popup dialog"

This reverts commit b28e618.
@Linus045

Copy link
Copy Markdown
Contributor Author

I've reverted the last commit so now it's back to the file size being on its own line, see #13371 (comment).

text = item_name,
url = item_path,
type = "file",
filesize = item_filesize

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tonumber is okay with nil, you can get rid of item_filesize

filesize = tonumber(item_content_length_match),

@Frenzie Frenzie added this to the 2025.02 milestone Mar 11, 2025
@Frenzie Frenzie merged commit 998a422 into koreader:master Mar 11, 2025
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
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.

4 participants