Store taskprocessing output files with extension to ease mimtype guessing#61689
Open
marcelklehr wants to merge 7 commits into
Open
Store taskprocessing output files with extension to ease mimtype guessing#61689marcelklehr wants to merge 7 commits into
marcelklehr wants to merge 7 commits into
Conversation
…ype guessing Signed-off-by: Marcel Klehr <mklehr@gmx.net>
marcelklehr
commented
Jul 1, 2026
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
a499488 to
944e422
Compare
Contributor
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.
Comment on lines
+1605
to
+1613
| if ($output[$key] instanceof FileShaped) { | ||
| $data = $output[$key]->getData(); | ||
| $ext = $output[$key]->getExtension(); | ||
| } else { | ||
| $data = $output[$key]; | ||
| $ext = ''; | ||
| } | ||
| /** @var SimpleFile $file */ | ||
| $file = $folder->newFile(time() . '-' . rand(1, 100000), $output[$key]); | ||
| $file = $folder->newFile(time() . '-' . rand(1, 100000) . ($ext ? '.' . $ext : ''), $data); |
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>
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.
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)