Fixed missing accountability for files.upload when TUS is enabled#26247
Conversation
There was a problem hiding this comment.
Seems this is due to using srvx, per the PR for node environments we should be able to do req.node.req.accountability to access the original request. This looks to work, thoughts?
That does indeed seem to work as a new way to access the underlying request (with our custom properties). I think however that using our own context (where we explicitly provide the correct accountability) is more future proof. If they ever decide to update this internal logic again then the context based approach will likely not break. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26247 +/- ##
==========================================
+ Coverage 59.16% 59.39% +0.22%
==========================================
Files 2079 2079
Lines 131577 131592 +15
Branches 7930 7984 +54
==========================================
+ Hits 77844 78154 +310
+ Misses 53733 53438 -295
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
files.upload when TUS is enabled
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [directus/directus](https://github.com/directus/directus) | minor | `11.13.4` -> `11.14.0` | --- ### Release Notes <details> <summary>directus/directus (directus/directus)</summary> ### [`v11.14.0`](https://github.com/directus/directus/releases/tag/v11.14.0) [Compare Source](directus/directus@v11.13.4...v11.14.0) #####⚠️ Potential Breaking Changes - **[@​directus/stores](https://github.com/directus/stores)** - Removed sidebar states from app store ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) ##### ✨ New Features & Improvements - **[@​directus/app](https://github.com/directus/app)** - Added support for downloading multiple files and entire folder trees ([#​26006](directus/directus#26006) by [@​Nitwel](https://github.com/Nitwel)) - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - Added support for float intervals and min/max warnings for number inputs ([#​26190](directus/directus#26190) by [@​gaetansenn](https://github.com/gaetansenn)) - Made both sidebars resizable ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - Added header interface ([#​26302](directus/directus#26302) by [@​AlexGaillard](https://github.com/AlexGaillard)) - **[@​directus/api](https://github.com/directus/api)** - Added support for downloading multiple files and entire folder trees ([#​26006](directus/directus#26006) by [@​Nitwel](https://github.com/Nitwel)) - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - **[@​directus/types](https://github.com/directus/types)** - Added support for downloading multiple files and entire folder trees ([#​26006](directus/directus#26006) by [@​Nitwel](https://github.com/Nitwel)) - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - **[@​directus/utils](https://github.com/directus/utils)** - Added support for downloading multiple files and entire folder trees ([#​26006](directus/directus#26006) by [@​Nitwel](https://github.com/Nitwel)) - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#​26248](directus/directus#26248) by [@​ComfortablyCoding](https://github.com/ComfortablyCoding)) - **[@​directus/sdk](https://github.com/directus/sdk)** - Added support for downloading multiple files and entire folder trees ([#​26006](directus/directus#26006) by [@​Nitwel](https://github.com/Nitwel)) - **[@​directus/system-data](https://github.com/directus/system-data)** - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - **[@​directus/errors](https://github.com/directus/errors)** - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - **[@​directus/themes](https://github.com/directus/themes)** - Added AI chat sidebar ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) ##### 🐛 Bug Fixes & Optimizations - **[@​directus/app](https://github.com/directus/app)** - Fixed an issue where input focus ring disappears on hover ([#​26315](directus/directus#26315) by [@​formfcw](https://github.com/formfcw)) - Fixed display template not appearing for relations inside translations on new items ([#​26219](directus/directus#26219) by [@​gaetansenn](https://github.com/gaetansenn)) - Ensured the created revision uses the correct label ([#​26289](directus/directus#26289) by [@​vizzv](https://github.com/vizzv)) - Added reactive primaryKey prop to useFlows composable ([#​26287](directus/directus#26287) by [@​AlexGaillard](https://github.com/AlexGaillard)) - **[@​directus/api](https://github.com/directus/api)** - Added redirect validation ([#​26346](directus/directus#26346) by [@​br41nslug](https://github.com/br41nslug)) - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#​26248](directus/directus#26248) by [@​ComfortablyCoding](https://github.com/ComfortablyCoding)) - Updated synchronization of remotely stored extensions ([#​26192](directus/directus#26192) by [@​br41nslug](https://github.com/br41nslug)) - Fixed missing accountability for `files.upload` when TUS is enabled ([#​26247](directus/directus#26247) by [@​br41nslug](https://github.com/br41nslug)) - **[@​directus/types](https://github.com/directus/types)** - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#​26248](directus/directus#26248) by [@​ComfortablyCoding](https://github.com/ComfortablyCoding)) - Updated synchronization of remotely stored extensions ([#​26192](directus/directus#26192) by [@​br41nslug](https://github.com/br41nslug)) - **[@​directus/storage-driver-cloudinary](https://github.com/directus/storage-driver-cloudinary)** - Updated synchronization of remotely stored extensions ([#​26192](directus/directus#26192) by [@​br41nslug](https://github.com/br41nslug)) - **[@​directus/storage-driver-supabase](https://github.com/directus/storage-driver-supabase)** - Updated synchronization of remotely stored extensions ([#​26192](directus/directus#26192) by [@​br41nslug](https://github.com/br41nslug)) - **[@​directus/extensions-sdk](https://github.com/directus/extensions-sdk)** - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#​26215](directus/directus#26215) by [@​dependabot](https://github.com/dependabot)) - **[@​directus/system-data](https://github.com/directus/system-data)** - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#​26215](directus/directus#26215) by [@​dependabot](https://github.com/dependabot)) - **[@​directus/sdk](https://github.com/directus/sdk)** - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#​26215](directus/directus#26215) by [@​dependabot](https://github.com/dependabot)) - **[@​directus/themes](https://github.com/directus/themes)** - Made both sidebars resizable ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - **[@​directus/utils](https://github.com/directus/utils)** - Preserved Error when passed to run-script operation ([#​26234](directus/directus#26234) by [@​gaetansenn](https://github.com/gaetansenn)) - **[@​directus/composables](https://github.com/directus/composables)** - Set default sidebar shadow to false ([#​26259](directus/directus#26259) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) ##### 📦 Published Versions - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/storage-driver-s3@​12.0.13` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4zOS4xIiwidXBkYXRlZEluVmVyIjoiNDIuMzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/2365 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
Scope
What's changed:
After the
@tus/serverdependency update it looks like the Directus request object no longer gets properly propagated to its callback functions.createTusServerreceives the proper request object containingaccountability,schemaandtokenfrom our middlewareonUploadFinishcallback however seems to be lacking our custom properties listed aboveTo fix this issue I am using the
contextobject provided to thecreateTusServerfunction as the data for emitting the event instead of relying on thereqparameter of the callback.Potential Risks / Drawbacks
Tested Scenarios
Review Notes / Questions
Checklist
Fixes #26242