inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.32k stars 781 forks source link

Error when uploading images to Company/Part/etc #8111

Closed simonkuehling closed 2 months ago

simonkuehling commented 2 months ago

Please verify that this bug has NOT been raised before.

Describe the bug*

When uploading an image for a company, part or similar the upload does not work right now and I see an error in the browser console (see log output below).

(I cannot verify on the demo server at the moment - the site seems down possibly?)

Steps to Reproduce

  1. Open a company view
  2. clock "upload file" on the image area
  3. select a file for upload and click "Submit"

Expected behaviour

Image gets uploaded

Deployment Method

Version Information

Your InvenTree version status is: Development Version InvenTree Version 0.17.0 dev
Commit Hash f144158
Commit Date 2024-09-03
Commit Branch
API Version 249
Python Version 3.11.9
Django Version 4.2.15

Please verify if you can reproduce this bug on the demo site.

Relevant log output

Firefox Error console:

Uncaught (in promise) 
{
  "stack": "pe@http://192.168.177.12/static/web/assets/vendor-ldsTh9i5.js:62:116363\nZx@http://192.168.177.12/static/web/assets/vendor-ldsTh9i5.js:64:1033\nm@http://192.168.177.12/static/web/assets/vendor-ldsTh9i5.js:64:6064\n",
  "message": "Request failed with status code 405",
  "name": "AxiosError",
  "code": "ERR_BAD_REQUEST",
  "config": {
    "transitional": {
      "silentJSONParsing": true,
      "forcedJSONParsing": true,
      "clarifyTimeoutError": false
    },
    "adapter": [
      "xhr",
      "http",
      "fetch"
    ],
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 2500,
    "xsrfCookieName": "csrftoken",
    "xsrfHeaderName": "X-CSRFToken",
    "maxContentLength": -1,
    "maxBodyLength": -1,
    "env": {},
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/x-www-form-urlencoded",
      "Accept-Language": "en, en-us",
      "Authorization": "Token inv-ed952c49e3f6742a51847248397b76ae4a0085cd-20240823"
    },
    "baseURL": "http://192.168.177.12/",
    "withCredentials": true,
    "withXSRFToken": true,
    "method": "patch",
    "url": "company/",
    "data": {}
  },
  "request": {},
  "response": {
    "data": "",
    "status": 405,
    "statusText": "Method Not Allowed",
    "headers": {
      "allow": "GET, HEAD, OPTIONS",
      "connection": "keep-alive",
      "content-language": "en",
      "content-length": "0",
      "content-type": "text/html; charset=utf-8",
      "cross-origin-opener-policy": "same-origin",
      "date": "Wed, 11 Sep 2024 08:55:43 GMT",
      "referrer-policy": "same-origin",
      "server": "nginx/1.26.2",
      "vary": "Accept-Language, Cookie",
      "x-content-type-options": "nosniff",
      "x-frame-options": "DENY"
    },
    "config": {
      "transitional": {
        "silentJSONParsing": true,
        "forcedJSONParsing": true,
        "clarifyTimeoutError": false
      },
      "adapter": [
        "xhr",
        "http",
        "fetch"
      ],
      "transformRequest": [
        null
      ],
      "transformResponse": [
        null
      ],
      "timeout": 2500,
      "xsrfCookieName": "csrftoken",
      "xsrfHeaderName": "X-CSRFToken",
      "maxContentLength": -1,
      "maxBodyLength": -1,
      "env": {},
      "headers": {
        "Accept": "application/json, text/plain, */*",
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept-Language": "en, en-us",
        "Authorization": "Token inv-ed952c49e3f6742a51847248397b76ae4a0085cd-20240823"
      },
      "baseURL": "http://192.168.177.12/",
      "withCredentials": true,
      "withXSRFToken": true,
      "method": "patch",
      "url": "company/",
      "data": {}
    },
    "request": {}
  },
  "status": 405
}
SchrodingersGat commented 2 months ago

@simonkuehling thanks for reporting this. Fix incoming in https://github.com/inventree/InvenTree/pull/8120