Repository navigation
Fix upload to a public share path #22
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
Open
allexzander
wants to merge
7
commits into
codelathe:main
Choose a base branch
from
allexzander:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f6a92ce
Fix upload to a public share path: send the ! of /SHARED/!<token> une…
OleksandrFC c17785d
Increment version to 0.5.4
OleksandrFC 5f182c0
Build the upload query in one helper so the empty file and chunked br…
OleksandrFC 0bed0f0
PolicyList and ServerSettings keep their entries per instance
OleksandrFC 139c1b9
Add the server wrappers the FCD integration tests work around
OleksandrFC 02bff8a
Document that updateshare resets the share settings it does not send
OleksandrFC f26d3fd
Fix admin_deletegroup and admin_addnewuser, document the deleteuserfr…
OleksandrFC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright (c) 2024 FileCloud. All Rights Reserved. | ||
|
|
||
| import xml.etree.ElementTree as ET | ||
|
|
||
| from filecloudapi.datastructures import PolicyList, ServerSettings | ||
|
|
||
|
|
||
| def _policies(*names: str) -> ET.Element: | ||
| policies = "".join( | ||
| f"<policy><policyid>id_{name}</policyid><policyname>{name}</policyname></policy>" | ||
| for name in names | ||
| ) | ||
| return ET.fromstring(f"<policies>{policies}</policies>") | ||
|
|
||
|
|
||
| def _settings(**settings: str) -> ET.Element: | ||
| entries = "".join( | ||
| f"<setting><param>{name}</param><value>{value}</value></setting>" | ||
| for name, value in settings.items() | ||
| ) | ||
| return ET.fromstring(f"<settings>{entries}</settings>") | ||
|
|
||
|
|
||
| def test_policy_list_holds_only_its_own_response(): | ||
| first = PolicyList(_policies("a")) | ||
| second = PolicyList(_policies("b")) | ||
|
|
||
| assert [p.policyname for p in first] == ["a"] | ||
| assert [p.policyname for p in second] == ["b"] | ||
| assert second.first().policyid == "id_b" # type: ignore | ||
|
|
||
|
|
||
| def test_server_settings_hold_only_their_own_response(): | ||
| first = ServerSettings(_settings(TONIDOCLOUD_A="1")) | ||
| second = ServerSettings(_settings(TONIDOCLOUD_B="2")) | ||
|
|
||
| assert first.entries == {"TONIDOCLOUD_A": "1"} | ||
| assert second.entries == {"TONIDOCLOUD_B": "2"} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
useridhas to be the user's email. The server validates it as one (ShareRouter.php,addRequiredParam('userid', Valid::VALID_EMAIL, Filter::LOWER_CASE)) and answers 422 for a user name. Worth naming itemailor saying so in the docstring.