Skip to content

[refactor] File uploads - #12322

Open
SchrodingersGat wants to merge 10 commits into
inventree:masterfrom
SchrodingersGat:file-uploads
Open

[refactor] File uploads#12322
SchrodingersGat wants to merge 10 commits into
inventree:masterfrom
SchrodingersGat:file-uploads

Conversation

@SchrodingersGat

Copy link
Copy Markdown
Member

This PR refactors how file uploads are handled:

  • Single file upload path renamer
  • Keep files associated with their model type
  • Optionally associate files with their underlying model ID

In addition to reducing duplicated code (and potential bugs) - this PR can be used in the future to implement an auth check of uploaded files - and reject if the user does not have the required permissions to access those files. We can use the file path to determine the model type (and potentially ID) and then check if the user has the correct roles/permissions.

Tasks

  • Refactor existing upload_to endpoints
  • Fix bugs
  • Add unit testing for all potential upload points
  • Data migrations for moving existing uploaded files

@SchrodingersGat SchrodingersGat added this to the 1.5.0 milestone Jul 7, 2026
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for inventree-web-pui-preview ready!

Name Link
🔨 Latest commit c23d16f
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a4e271b3f0f5800096c2ce0
😎 Deploy Preview https://deploy-preview-12322--inventree-web-pui-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 92 (🟢 up 1 from production)
Accessibility: 82 (no change from production)
Best Practices: 92 (no change from production)
SEO: 78 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@SchrodingersGat
SchrodingersGat requested a review from matmair July 7, 2026 04:58
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.59%. Comparing base (b63d829) to head (c23d16f).
⚠️ Report is 2 commits behind head on master.

❌ Your patch check has failed because the patch coverage (94.11%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12322      +/-   ##
==========================================
+ Coverage   83.20%   86.59%   +3.39%     
==========================================
  Files        1393     1397       +4     
  Lines       91285    91509     +224     
  Branches    10588    10468     -120     
==========================================
+ Hits        75950    79246    +3296     
+ Misses      15270    12201    -3069     
+ Partials       65       62       -3     
Flag Coverage Δ
backend 90.63% <92.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 92.16% <91.30%> (-0.11%) ⬇️
Backend General 93.00% <94.11%> (-0.36%) ⬇️
Frontend 79.53% <ø> (+8.41%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/backend/InvenTree/common/media.py Outdated
@SchrodingersGat SchrodingersGat modified the milestones: 1.5.0, 2.0.0 Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants