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

Inconsistent behavior when uploading to external storage root vs sub directory #605

Open
st3iny opened this issue Sep 25, 2024 · 2 comments

Comments

@st3iny
Copy link
Member

st3iny commented Sep 25, 2024

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

Preparation (one time)

  1. Configure a file access rule to block uploads above 5 Mb
  2. Ensure that chunked upload is enabled: occ config:app:delete files max_chunk_size
  3. Add an external S3 storage.
  4. Create a sub directory inside the external storage.

Case 1 (correct)

  1. Upload a big file directly to the external storage's root folder.
  2. Observe that the upload is blocked after all chunks were uploaded (error on assembly).

Case 2 (broken)

  1. Upload a big file to the sub directory inside the external store.
  2. Observe that the upload is blocked immediately when starting the first chunk.

Expected behavior

Case 1 is behaving as expected. Case 2 is not behaving as expected. The upload should be blocked after assembly in both cases.

Actual behavior

The upload is blocked immediately in case 2 instead of postponing the check until the whole file is available like in case 1.

Server configuration

Web server: Apache (Content-Length fix is applied)

PHP version: 8.1

Nextcloud version: master

@st3iny st3iny self-assigned this Sep 25, 2024
@st3iny st3iny changed the title Inconsistent behaviour when uploading to external storage root vs sub directory Inconsistent behavior when uploading to external storage root vs sub directory Sep 25, 2024
@st3iny st3iny removed their assignment Sep 25, 2024
@nickvergessen
Copy link
Member

Case 1 (correct)
Case 2 (broken)

Not sure about that. As soon as we know that the upload will be blocked, we should block it.

@st3iny
Copy link
Member Author

st3iny commented Sep 27, 2024

True, but now I'm really confused. Weren't the checks delayed on purpose to prevent early scans on incomplete files? Because some checks might yield false positives when run on chunks instead of the complete file.

So I'd expect consistent behavior of waiting until all chunks are uploaded for all cases. Regardless of the file is being uploaded to /my-ext-storage or /my-ext-storage/foobar/.

See #330

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

No branches or pull requests

2 participants