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

Upload in file-drop public link flattens folder hierarchy #2443

Closed
skshetry opened this issue Nov 12, 2019 · 24 comments
Closed

Upload in file-drop public link flattens folder hierarchy #2443

skshetry opened this issue Nov 12, 2019 · 24 comments
Labels
Milestone

Comments

@skshetry
Copy link
Member

skshetry commented Nov 12, 2019

Steps to reproduce

  1. Create a files-drop link.
  2. Open the files-drop link.

Expected behaviour

Some way to upload folder

Actual behaviour

No way to upload a folder. Dragging a folder uploads the contents of the folder (recurse through it and flattens them).
Also, using setValue and trying to upload folder through Nightwatch creates an empty file.

@skshetry skshetry added the Type:Bug Something isn't working label Nov 12, 2019
@PVince81
Copy link
Contributor

@skshetry mind trying this with OC 10 ?

as far as I remember we don't support subdirectories in files drop mode so this might be expected behavior

@skshetry skshetry self-assigned this Nov 12, 2019
@skshetry
Copy link
Member Author

skshetry commented Nov 14, 2019

@PVince81, Folder uploads in OC 10 are not supported at all. Close this or is this a requirement (it is listed on #2222)?

Also, phoenix should not upload folder as an empty file nor should it flatten them and upload inside a same folder.

@PVince81
Copy link
Contributor

not a requirement imo, it would mess up the concept and make it more complex as we'd need to avoid file name collisions even across folders.

@pmaier1 thoughts ?

@PVince81
Copy link
Contributor

@pmaier1 please reopen if you think we want to change how it works in Phoenix

@skshetry
Copy link
Member Author

skshetry commented Nov 15, 2019

@PVince81, then, I would not expect the contents of sub-folders getting uploaded in the root of the publicly-shared folder (at least they should be in their respective sub-folders).

Re-opening, feel free to close if you don't think, that is an issue.

@skshetry skshetry reopened this Nov 15, 2019
@PVince81
Copy link
Contributor

@skshetry you're right. We need to block this with a warning.

@PVince81 PVince81 added this to the backlog milestone Nov 15, 2019
@skshetry skshetry removed their assignment Nov 21, 2019
@pascalwengerter
Copy link
Contributor

@skshetry could you retry this with all the changes that have occured in the last ~1,5 years? Should work fine now 😉

@dpakach
Copy link
Contributor

dpakach commented Apr 12, 2021

@pascalwengerter, uploading folders seems to work but all the files in the folder will be flattened.
for example, if we upload a folder with the following structure

├── upload
│   ├── file1.pdf
│   ├── file.ttf
│   └── sub
│       └── file2.pdf

it will upload all 3 files file1.pdf, file.ttf, and file2.pdf will be uploaded in the same folder. Is that correct behavior?

Uploading a similar folder in the main files section keeps the folder structure of the originally uploaded folder.

@saw-jan
Copy link
Member

saw-jan commented Jun 28, 2021

@pascalwengerter
Is the current behavior the expected one?

@pascalwengerter
Copy link
Contributor

@pascalwengerter
Is the current behavior the expected one?

No, should upload the folder including files & subfolders the way they were structured before

@pascalwengerter pascalwengerter mentioned this issue May 5, 2022
10 tasks
@kulmann kulmann changed the title Uploading folders does not work in files-drop Upload in file-drop public link flattens folder hierarchy May 9, 2022
@kulmann kulmann added Priority:p2-high Escalation, on top of current planning, release blocker and removed Priority:p3-medium Normal priority labels May 9, 2022
@kulmann kulmann added Priority:p1-urgent Consider a hotfix release with only that fix and removed Priority:p2-high Escalation, on top of current planning, release blocker labels May 9, 2022
@kulmann
Copy link
Contributor

kulmann commented May 9, 2022

Uploads have been mostly re-implemented in a recent pull request (#6202). Issue still seems to be present. Since this corrupts uploaded data / modifies uploaded data in an unexpected way I've decided to elevate this to a P1.

@JammingBen JammingBen self-assigned this May 10, 2022
@JammingBen
Copy link
Contributor

@pmaier1

We noticed some inconsistencies between oC10 and oCIS when uploading contents to a public drop-page:

When uploading a file that already exists, oC10 will create a new file with a suffix (e.g. file (1)). oCIS in the other hand just overwrites the existing file by creating a new version. What is the desired behavior here? Also, how do we deal with folder uploads in this case? The classic UI does not support folder uploads on public drop-pages, but the new WebUI does.

@pmaier1
Copy link
Contributor

pmaier1 commented May 12, 2022

When uploading a file that already exists, oC10 will create a new file with a suffix (e.g. file (1)). oCIS in the other hand just overwrites the existing file by creating a new version. What is the desired behavior here?

Thanks for pointing at this. IMO the oC10 behavior is correct. Main reason for that is that we should cover for the case that occurs when multiple people upload files with the same name to a file drop link. In that case it does not make sense to create versions as the files most probably really are distinct except that they have the same name. Same behavior for folders then.
IIRC there was some ticket in ocis or reva repo discussion this behavior but I can't find it atm.

Apart from that, I think the versioning feature should not be exposed at all in the context of a (public) link.

@pmaier1
Copy link
Contributor

pmaier1 commented May 12, 2022

IIRC there was some ticket in ocis or reva repo discussion this behavior but I can't find it atm.

Found it

The behavior is described, discussed and agreed there. cc @micbar

@JammingBen
Copy link
Contributor

Thx for the input!

Then I guess Web just sends the data to oCIS, which checks and handles the duplicate case. Technically, this is a bit challenging for folders. Because with folder uploads, Web first creates all folders and then uploads resources to those. Now if oCIS stored My Folder as My Folder (1), Web would need to know that to properly upload the following files. Not sure yet how the best solution looks like... cc @kulmann

@phil-davis
Copy link
Contributor

The response to the initial create of a folder is going to return some HTTP status 2nn. The response could also have the actual "allocated" resource name as a data item in the response body. Then the client can know what name the folder has, and can then create the rest of the folder structure under that folder name.

The other approach would be that if the folder already exists, then the server can respond with something like 409 "conflict", and in the response body provide a suggested alternative folder name xyz (1) for example. The problem with that is that the client has to loop possibly multiple times. By the time the client gets the response and then sends a request to create xyz (1), some other client might have done the same, and the server will now respond again with 409 and suggest xyz (2) ...

@pascalwengerter
Copy link
Contributor

The response to the initial create of a folder is going to return some HTTP status 2nn. The response could also have the actual "allocated" resource name as a data item in the response body. Then the client can know what name the folder has, and can then create the rest of the folder structure under that folder name.

The other approach would be that if the folder already exists, then the server can respond with something like 409 "conflict", and in the response body provide a suggested alternative folder name xyz (1) for example. The problem with that is that the client has to loop possibly multiple times. By the time the client gets the response and then sends a request to create xyz (1), some other client might have done the same, and the server will now respond again with 409 and suggest xyz (2) ...

There is also a security concern about not disclosing what files&folders are present in whatever folder you create a dropLink for - which means the backend should "silently swallow" whatever the public uploads there and then handle renaming backend-only

@JammingBen
Copy link
Contributor

I'm all in favor of letting the backend handle this, hence the first approach sounds good to me:

The response to the initial create of a folder is going to return some HTTP status 2nn. The response could also have the actual "allocated" resource name as a data item in the response body. Then the client can know what name the folder has, and can then create the rest of the folder structure under that folder name.

However, either way, the client will know that there is a resource with that exact name. I'm not sure if that is information we want to publish to the outside world.

@pascalwengerter
Copy link
Contributor

I'm all in favor of letting the backend handle this, hence the first approach sounds good to me:

The response to the initial create of a folder is going to return some HTTP status 2nn. The response could also have the actual "allocated" resource name as a data item in the response body. Then the client can know what name the folder has, and can then create the rest of the folder structure under that folder name.

However, either way, the client will know that there is a resource with that exact name. I'm not sure if that is information we want to publish to the outside world.

Can't we handle subsequent (child folder) uploads based on the resourceId of the previously uploaded (parent) resource, hence not disclosing anything about potential renaming happening?

@pmaier1
Copy link
Contributor

pmaier1 commented May 12, 2022

There is also a security concern about not disclosing what files&folders are present in whatever folder you create a dropLink for - which means the backend should "silently swallow" whatever the public uploads there and then handle renaming backend-only

Exactly, this is important. Clients must not have any way to infer the content of the file drop folder.

@phil-davis
Copy link
Contributor

phil-davis commented May 12, 2022

Can't we handle subsequent (child folder) uploads based on the resourceId of the previously uploaded (parent) resource, hence not disclosing anything about potential renaming happening?

That sounds promising - the response to the "create resource" request can provide a resourceId which is a "magic string" unrelated to the resource name. The client can then create child resources under that.

@JammingBen
Copy link
Contributor

JammingBen commented May 12, 2022

Good idea, AFAIK this would need to be implemented first though. The ownCloud SDK (and oCIS itself?) only works with paths and names.

@JammingBen
Copy link
Contributor

I researched a bit on how things work and what needs to be done if we aim for this solution. There's quite a lot unfortunately:

  • oCIS must return the resourceIds of newly created folders (is this valid though?)
  • oCIS must implement a way to support file uploads via resourceId
  • SDK must be adjusted to support file uploads via resourceId
  • Folder upload mechanism must be adjusted in Web to match this process

@PrajwolAmatya
Copy link
Contributor

PrajwolAmatya commented Feb 14, 2024

This issue doesn't seem to occur in latest master. Upload folder to public link share works fine and also the issue mentioned in this comment #2443 (comment), the structure of the folder is not affected.
Checked manually by uploading the folder with following structure in a public link share.

├── upload
│   ├── file1.txt
│   ├── file2.txt
│   └── sub
│       ├── file1.pdf
│       └── file2.pdf

The folder is uploaded with the same folder structure. The folder upload is currently not supported in playwright, so only tested manually. So, closing this issue for now.
CC @ScharfViktor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Status: Blocked
Development

Successfully merging a pull request may close this issue.

10 participants