]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: correctly handle empty user for old notes api format, fix frontend API version...
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 1 May 2025 21:45:37 +0000 (14:45 -0700)
committerGitHub <noreply@github.com>
Thu, 1 May 2025 21:45:37 +0000 (14:45 -0700)
src-ui/src/environments/environment.prod.ts
src/documents/serialisers.py
src/paperless/settings.py

index c9a59b2d2a8a6aa080b6f715bc8b7d13e6c5bdb2..2bc42f4e96f63adb863d5134fb1c2ed0f1eed5d6 100644 (file)
@@ -3,7 +3,7 @@ const base_url = new URL(document.baseURI)
 export const environment = {
   production: true,
   apiBaseUrl: document.baseURI + 'api/',
-  apiVersion: '7',
+  apiVersion: '8', // match src/paperless/settings.py
   appTitle: 'Paperless-ngx',
   version: '2.15.3',
   webSocketHost: window.location.host,
index b6f61103f822ce5d681aab8414a3bba7b7abca51..e340e852524c1d616f34fc1d584800026f7cd86b 100644 (file)
@@ -885,7 +885,7 @@ class NotesSerializer(serializers.ModelSerializer):
             request.version if request else settings.REST_FRAMEWORK["DEFAULT_VERSION"],
         )
 
-        if api_version < 8:
+        if api_version < 8 and "user" in ret:
             user_id = ret["user"]["id"]
             ret["user"] = user_id
 
index a8370657167d013a959da053d13a72df1bdf4d1b..4906b4713c9e53ca9597b569af1343ef1e873ab0 100644 (file)
@@ -342,7 +342,7 @@ REST_FRAMEWORK = {
         "rest_framework.authentication.SessionAuthentication",
     ],
     "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.AcceptHeaderVersioning",
-    "DEFAULT_VERSION": "8",
+    "DEFAULT_VERSION": "8",  # match src-ui/src/environments/environment.prod.ts
     # Make sure these are ordered and that the most recent version appears
     # last. See api.md#api-versioning when adding new versions.
     "ALLOWED_VERSIONS": ["1", "2", "3", "4", "5", "6", "7", "8"],