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

userbrowse.py: handle usernames with invalid path chars in share lists #2892

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mathiascode
Copy link
Member

  • Add .json file extension to lists saved to disk
  • Add metadata section containing the original username, in case it contained characters that were removed from the filename

- Add .json file extension to lists saved to disk
- Add metadata section containing the original username, in case it
contained characters that were removed from the filename
@@ -186,6 +186,9 @@ def iter_matching_folders(self, requested_folder_path, browsed_user, recurse=Fal
def load_shares_list_from_disk(self, file_path):

file_path_encoded = encode_path(file_path)
suffix = None
metadata_index = None
username = None

try:
try:
Copy link
Member

@slook slook Feb 22, 2024

Choose a reason for hiding this comment

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

This try try except except structure seems clumsy, and this method is becoming too long.

Consider creating small helper function(s) such as:

  • _open_shares_file()
  • _read_shares_file()
  • _get_metadata_username()

@slook
Copy link
Member

slook commented Feb 22, 2024

This bugs seems low priority, I'd suggest waiting to merge this until 3.3.2.dev1.

@slook
Copy link
Member

slook commented Mar 4, 2024

Can the new metadata field be used to contain other data in future, for example, favorite folders, file and folder counts?

Having such extra metadata would be faster than using iteration for counting items, in order for a feature or plugin to quickly check if the shares list needs updating to get newly added items. Not saying to add anything extra now, just saying the metadata field is a really good idea.

Does it need testing to see what happens if the list is loaded by an older version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants