Repository navigation
Conversation
15a0d06 to
7c64154
Compare
5a07907 to
61382c1
Compare
icewind1991
left a comment
There was a problem hiding this comment.
Backend wise, looks good otherwise
| /** | ||
| * @param class-string $collectionClass | ||
| */ | ||
| private function isChildOf(string $path, string $collectionClass): bool { |
There was a problem hiding this comment.
The name of the method doesn't really match the functionality (anymore?).
|
|
||
| $linkCheckPlugin = new PublicLinkCheckPlugin(); | ||
| $filesDropPlugin = new FilesDropPlugin(); | ||
| $allowedFileTypesPlugin = new AllowedFileTypesPlugin(Server::get(IMimeTypeDetector::class)); |
There was a problem hiding this comment.
You can directly get the AllowedFileTypesPlugin from Server::get instead of just it's constructor parameter.
This mainly removes friction if the params of AllowedFileTypesPlugin ever need to be changed in the future.
Signed-off-by: Vladyslav Lotysh <lotysh.vm@gmail.com> Assisted-by: ClaudeCode:claude-opus-5-5
61382c1 to
cb0b075
Compare
salmart-dev
left a comment
There was a problem hiding this comment.
Hello @vlotysh thanks for your PR 😄
The direction looks good, I would suggest some improvements and spotted a few issues.
completeness: the PR doesn't seem to cover the file requests dialog (NewFileRequestDialog), which could benefit from the same feature.
usability: I think the current design would be quite hard to use for the following reasons:
- the UI expects a comma-separated free-form text, which is very easy to get wrong, for example with a typo, and very hard for a non-technical person to use
- there is no validation for either extensions or mime types, so if there is an issue with the input, the person configuring the share won't know until a user will complain that uploading is not working.
- it is confusing to be able to provide a mime-type, but this still resulting into just an extension check and could be misleading, so should probably be mentioned in the UI that it would just be a convenience filter, or the mime-type should actually detected via the file content.
I would have a few suggestions to make this much more usable from my point of view:
- suggestion: free text should only be accepted for file extensions, to allow users requesting files with extensions that the server does not recognise. Free-form input of MIME-types is useless in this case, as anything the server would not recognise would be rejected.
- usability: MIME types should be suggested/pickable from a list, as hey are known by the backend. This eliminates the possibility of typos that would be hard to spot.
- nice-to-have: the server already has an extensible list of mime types, with human-readable names. This PR could build on that by adding a similar extensible list for categories that map to lists of mimes, e.g. 'Documents',
Images,Audio,Video, etc... that could be also selectable and include more than one MIME-type. This way users could start typing and get a category or a MIME-type offered, or also input a custom extension.
| * Main idea: Browsers take MIME types from the OS (application/x-zip-compressed e.g.), | ||
| * which can differ from the server detection, so MIME rules are checked by the server only. | ||
| * We will only check extensions here, and if the list contains MIME types, we will let the server handle it. | ||
| * Chunking will diclined unsupported file types |
There was a problem hiding this comment.
nitpick: typo on word decline
| * We will only check extensions here, and if the list contains MIME types, we will let the server handle it. | ||
| * Chunking will diclined unsupported file types | ||
| * | ||
| * But if extensions are provided, we will check them here, as the server will not check them. |
There was a problem hiding this comment.
question: I don't think this matches the implementation. The code is always and only checking the extension, right?
| public function initialize(Server $server): void { | ||
| $this->server = $server; | ||
| $server->on('beforeMethod:MKCOL', [$this, 'beforeMkcol']); | ||
| $server->on('beforeBind', [$this, 'beforeBind']); |
There was a problem hiding this comment.
fix: this only runs after FilesDropPlugin already creates the folder structure for the upload and when upload is blocked, so those folders would be left behind when upload is rejected.
Hi! Thanks for the review. I'll build the list of MIME types from |
Signed-off-by: Vladyslav Lotysh <lotysh.vm@gmail.com> Assisted-by: ClaudeCode:claude-opus-5-5
…e server Signed-off-by: Vladyslav Lotysh <lotysh.vm@gmail.com> Assisted-by: ClaudeCode:claude-opus-5-5
|
Commit 1
|
Summary
IMimeTypeDetector::detectPath(), the file content is not inspected.PUT→beforeBind→415 Unsupported Media Type.MKCOL uploads/<token>/<id>with aDestinationheader →beforeMkcol→ 415 before the first chunk is sent.MOVE .fileis checked inbeforeBindagainst the destination name, before the chunks are assembled.MOVE/COPYof collections that are not part of the share (upload folders) → 403.upload.allowed_typesattribute are not affected.before

after


Checklist
3. to review, feature component)stable32)AI (if applicable)