Store taskprocessing output files with extension to ease mimtype guessing#61689
Store taskprocessing output files with extension to ease mimtype guessing#61689marcelklehr wants to merge 15 commits into
Conversation
a499488 to
944e422
Compare
There was a problem hiding this comment.
Pull request overview
This PR extends the TaskProcessing public API and implementation to better handle “file-shaped” task outputs by allowing providers (and ExApps uploads) to influence stored output filenames via extensions, with the goal of improving MIME type detection downstream. It also annotates several public TaskProcessing interfaces/data objects with #[Implementable] / #[Consumable] attributes.
Changes:
- Introduces
OCP\TaskProcessing\FileShapedand updates synchronous provider return type annotations to allow returningFileShapedvalues. - Extends output validation (
EShapeType::validateOutputWithFileData) and output encapsulation (Manager::encapsulateOutputFileData) to accept file-shaped outputs. - Appends file extensions when storing uploaded/provider output data in AppData, and adds
Implementable/Consumableattributes to several public APIs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/public/TaskProcessing/SynchronousProviderOptions.php | Marks the options class as #[Consumable] for public API consumption. |
| lib/public/TaskProcessing/ShapeEnumValue.php | Marks the DTO as #[Consumable]. |
| lib/public/TaskProcessing/ShapeDescriptor.php | Marks the DTO as #[Consumable]. |
| lib/public/TaskProcessing/ITriggerableProvider.php | Marks provider interface as #[Implementable] (but since metadata needs correction). |
| lib/public/TaskProcessing/ITaskType.php | Marks task type interface as #[Implementable]. |
| lib/public/TaskProcessing/ISynchronousProvider.php | Marks interface as #[Implementable] and expands psalm return types to include FileShaped. |
| lib/public/TaskProcessing/ISynchronousOptionsAwareProvider.php | Marks interface as #[Implementable] and expands psalm return types to include FileShaped. |
| lib/public/TaskProcessing/IProvider.php | Marks provider interface as #[Implementable]. |
| lib/public/TaskProcessing/IInternalTaskType.php | Marks internal task type interface as #[Implementable] (minor formatting consistency). |
| lib/public/TaskProcessing/FileShaped.php | Adds new public DTO to carry file-shaped output data + metadata (extension/mime type). |
| lib/public/TaskProcessing/EShapeType.php | Updates output validation to allow FileShaped (but list validation currently has critical logic errors). |
| lib/private/TaskProcessing/Manager.php | Stores file outputs using provided extensions (but list branch currently clears unrelated output keys and needs extension normalization). |
| core/Controller/TaskProcessingApiController.php | Appends extension when storing ExApp uploaded files (needs extension sanitization/normalization). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ype guessing Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…erty Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Assisted-by: ClaudeCode:claude-opus-4-8 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
8d2c8e2 to
70e7fea
Compare
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
3c6bd44 to
326b94a
Compare
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
lukasdotcom
left a comment
There was a problem hiding this comment.
Something small I noticed while skimming.
|
lgtm apart from Lukas' review ✅ |
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
lukasdotcom
left a comment
There was a problem hiding this comment.
I'd still swap the order of the denylist incase there is some random character that can be put into the extension and that is then filtered out on line 64. Otherwise looks good.
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Ah, yes. that would be a mean attack indeed. Changed it :) |
Summary
Currently, we have to guess the mime type entirely from the data which is sometimes hard. With this we allow synchronous providers to hint the file extension and mime type.
Also adds some needed attributes.
TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)