Repository navigation
Conversation
SeqLaz
force-pushed
the
fixing_windows_validation_error
branch
from
December 3, 2026 15:56
bce4586 to
ee431c3
Compare
suricactus
reviewed
Dec 3, 2026
suricactus
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the fix! A few small changes to do before merging.
| # if the filepath is invalid, it will throw a new error `pathvalidate.ValidationError` | ||
| is_valid_filepath(str(local_filename)) | ||
|
|
||
| remote_filename_posix = Path(remote_filename).as_posix() |
Collaborator
There was a problem hiding this comment.
Suggested change
| remote_filename_posix = Path(remote_filename).as_posix() |
Keep the empty line above, and actually move this where it is used. IMO we don't even need the variable.
| unit_scale=True, | ||
| unit="B", | ||
| desc=f'Uploading "{remote_filename}"...', | ||
| desc=f'Uploading "{remote_filename_posix}"...', |
Collaborator
There was a problem hiding this comment.
Suggested change
| desc=f'Uploading "{remote_filename_posix}"...', | |
| desc=f'Uploading "{remote_filename}"...', |
This is shown to the user, use the local file path slash convention.
| encoder_params["callback"] = cb | ||
| else: | ||
| logger.info(f'Uploading file "{remote_filename}"…') | ||
| logger.info(f'Uploading file "{remote_filename_posix}"…') |
Collaborator
There was a problem hiding this comment.
Suggested change
| logger.info(f'Uploading file "{remote_filename_posix}"…') | |
| logger.info(f'Uploading file "{remote_filename}"…') |
This is shown to the user, use the local file path slash convention.
| fields={ | ||
| "file": ( | ||
| str(remote_filename), | ||
| str(remote_filename_posix), |
Collaborator
There was a problem hiding this comment.
Suggested change
| str(remote_filename_posix), | |
| str(remote_filename), |
This is shown to the user, use the local file path slash convention.
| @@ -1024,14 +1024,14 @@ def cb(monitor: MultipartEncoderMonitor) -> None: | |||
| ) | |||
|
|
|||
| if upload_type == FileTransferType.PROJECT: | |||
Collaborator
There was a problem hiding this comment.
Either add on the line before the if:
remote_filename_posix = Path(remote_filename).as_posix()
Or change lines below as:
url = f"files/{project_id}/{remote_filename.as_posix()}"
Both are fine with me.
|
Sentry Issue: QFIELDCLOUD-4N1 |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes
400 Bad Request(validation_error) failures when uploading project files located in subdirectories from Windowsexample:
The root of the error is due to the backslash passed to the URL (
%5C)