Compare commits

..

No commits in common. "dev" and "v2.17.1" have entirely different histories.
dev ... v2.17.1

9 changed files with 56 additions and 163 deletions

View File

@ -1,55 +0,0 @@
title: "[Support] "
body:
- type: textarea
id: description
attributes:
label: What's your question or issue?
description: Provide a clear and concise description of what you're trying to do, and what's going wrong.
placeholder: |
I'm trying to...
[Include screenshots if helpful]
validations:
required: true
- type: textarea
id: steps
attributes:
label: What have you tried?
description: Describe any steps you've already taken to troubleshoot or solve the issue.
placeholder: |
- I checked the logs and saw...
- I followed the install guide and tried...
- type: input
id: version
attributes:
label: Paperless-ngx version
placeholder: e.g. 1.14.0
validations:
required: true
- type: input
id: host-os
attributes:
label: Host OS
description: Include architecture if relevant.
placeholder: e.g. Ubuntu 22.04 / Raspberry Pi arm64
- type: dropdown
id: install-method
attributes:
label: Installation method
options:
- Docker - official image
- Docker - linuxserver.io image
- Bare metal
- Other (please describe above)
- type: textarea
id: system-status
attributes:
label: System status
description: If available, copy & paste the system status output from Settings > System Status > Copy
render: json
- type: textarea
id: logs
attributes:
label: Relevant logs or output
description: If you have logs, errors that might help, paste it here.
render: bash

View File

@ -1,15 +1,5 @@
# Changelog # Changelog
## paperless-ngx 2.17.1
### Bug Fixes
- Fix: correct PAPERLESS_EMPTY_TRASH_DIR to Path [@shamoon](https://github.com/shamoon) ([#10227](https://github.com/paperless-ngx/paperless-ngx/pull/10227))
### All App Changes
- Fix: correct PAPERLESS_EMPTY_TRASH_DIR to Path [@shamoon](https://github.com/shamoon) ([#10227](https://github.com/paperless-ngx/paperless-ngx/pull/10227))
## paperless-ngx 2.17.0 ## paperless-ngx 2.17.0
### Breaking Changes ### Breaking Changes
@ -6007,6 +5997,7 @@ primarily.
a very good job at ocr'ing a document with the default a very good job at ocr'ing a document with the default
language. Certain language specifics such as umlauts may not get language. Certain language specifics such as umlauts may not get
picked up properly. picked up properly.
- `PAPERLESS_DEBUG` defaults to `false`.
- The presence of `PAPERLESS_DBHOST` now determines whether to use - The presence of `PAPERLESS_DBHOST` now determines whether to use
PostgreSQL or SQLite. PostgreSQL or SQLite.
- `PAPERLESS_OCR_THREADS` is gone and replaced with - `PAPERLESS_OCR_THREADS` is gone and replaced with

View File

@ -1,6 +1,10 @@
# Have a look at the docs for documentation. # Have a look at the docs for documentation.
# https://docs.paperless-ngx.com/configuration/ # https://docs.paperless-ngx.com/configuration/
# Debug. Only enable this for development.
#PAPERLESS_DEBUG=false
# Required services # Required services
#PAPERLESS_REDIS=redis://localhost:6379 #PAPERLESS_REDIS=redis://localhost:6379

View File

@ -221,6 +221,9 @@ lint.per-file-ignores."src/documents/parsers.py" = [
lint.per-file-ignores."src/documents/signals/handlers.py" = [ lint.per-file-ignores."src/documents/signals/handlers.py" = [
"PTH", "PTH",
] # TODO Enable & remove ] # TODO Enable & remove
lint.per-file-ignores."src/paperless/settings.py" = [
"PTH",
] # TODO Enable & remove
lint.per-file-ignores."src/paperless_tesseract/tests/test_parser.py" = [ lint.per-file-ignores."src/paperless_tesseract/tests/test_parser.py" = [
"RUF001", "RUF001",
] ]

View File

@ -67,8 +67,7 @@
"jest-websocket-mock": "^2.5.0", "jest-websocket-mock": "^2.5.0",
"prettier-plugin-organize-imports": "^4.1.0", "prettier-plugin-organize-imports": "^4.1.0",
"ts-node": "~10.9.1", "ts-node": "~10.9.1",
"typescript": "^5.5.4", "typescript": "^5.5.4"
"webpack": "^5.98.0"
}, },
"pnpm": { "pnpm": {
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [

67
src-ui/pnpm-lock.yaml generated
View File

@ -174,9 +174,6 @@ importers:
typescript: typescript:
specifier: ^5.5.4 specifier: ^5.5.4
version: 5.5.4 version: 5.5.4
webpack:
specifier: ^5.98.0
version: 5.98.0(esbuild@0.25.4)
packages: packages:
@ -6190,7 +6187,7 @@ snapshots:
dependencies: dependencies:
'@ampproject/remapping': 2.3.0 '@ampproject/remapping': 2.3.0
'@angular-devkit/architect': 0.1902.14(chokidar@4.0.3) '@angular-devkit/architect': 0.1902.14(chokidar@4.0.3)
'@angular-devkit/build-webpack': 0.1902.14(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0) '@angular-devkit/build-webpack': 0.1902.14(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.4)))(webpack@5.98.0(esbuild@0.25.4))
'@angular-devkit/core': 19.2.14(chokidar@4.0.3) '@angular-devkit/core': 19.2.14(chokidar@4.0.3)
'@angular/build': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14)(@angular/localize@19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14))(@types/node@22.15.29)(chokidar@4.0.3)(jiti@1.21.7)(less@4.2.2)(postcss@8.5.2)(terser@5.39.0)(typescript@5.5.4)(yaml@2.7.0) '@angular/build': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14)(@angular/localize@19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14))(@types/node@22.15.29)(chokidar@4.0.3)(jiti@1.21.7)(less@4.2.2)(postcss@8.5.2)(terser@5.39.0)(typescript@5.5.4)(yaml@2.7.0)
'@angular/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4) '@angular/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4)
@ -6204,14 +6201,14 @@ snapshots:
'@babel/preset-env': 7.26.9(@babel/core@7.26.10) '@babel/preset-env': 7.26.9(@babel/core@7.26.10)
'@babel/runtime': 7.26.10 '@babel/runtime': 7.26.10
'@discoveryjs/json-ext': 0.6.3 '@discoveryjs/json-ext': 0.6.3
'@ngtools/webpack': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(typescript@5.5.4)(webpack@5.98.0) '@ngtools/webpack': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4))
'@vitejs/plugin-basic-ssl': 1.2.0(vite@6.2.7(@types/node@22.15.29)(jiti@1.21.7)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.7.0)) '@vitejs/plugin-basic-ssl': 1.2.0(vite@6.2.7(@types/node@22.15.29)(jiti@1.21.7)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.7.0))
ansi-colors: 4.1.3 ansi-colors: 4.1.3
autoprefixer: 10.4.20(postcss@8.5.2) autoprefixer: 10.4.20(postcss@8.5.2)
babel-loader: 9.2.1(@babel/core@7.26.10)(webpack@5.98.0) babel-loader: 9.2.1(@babel/core@7.26.10)(webpack@5.98.0(esbuild@0.25.4))
browserslist: 4.25.0 browserslist: 4.25.0
copy-webpack-plugin: 12.0.2(webpack@5.98.0) copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.4))
css-loader: 7.1.2(webpack@5.98.0) css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.4))
esbuild-wasm: 0.25.4 esbuild-wasm: 0.25.4
fast-glob: 3.3.3 fast-glob: 3.3.3
http-proxy-middleware: 3.0.5 http-proxy-middleware: 3.0.5
@ -6219,32 +6216,32 @@ snapshots:
jsonc-parser: 3.3.1 jsonc-parser: 3.3.1
karma-source-map-support: 1.4.0 karma-source-map-support: 1.4.0
less: 4.2.2 less: 4.2.2
less-loader: 12.2.0(less@4.2.2)(webpack@5.98.0) less-loader: 12.2.0(less@4.2.2)(webpack@5.98.0(esbuild@0.25.4))
license-webpack-plugin: 4.0.2(webpack@5.98.0) license-webpack-plugin: 4.0.2(webpack@5.98.0(esbuild@0.25.4))
loader-utils: 3.3.1 loader-utils: 3.3.1
mini-css-extract-plugin: 2.9.2(webpack@5.98.0) mini-css-extract-plugin: 2.9.2(webpack@5.98.0(esbuild@0.25.4))
open: 10.1.0 open: 10.1.0
ora: 5.4.1 ora: 5.4.1
picomatch: 4.0.2 picomatch: 4.0.2
piscina: 4.8.0 piscina: 4.8.0
postcss: 8.5.2 postcss: 8.5.2
postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0) postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4))
resolve-url-loader: 5.0.0 resolve-url-loader: 5.0.0
rxjs: 7.8.1 rxjs: 7.8.1
sass: 1.85.0 sass: 1.85.0
sass-loader: 16.0.5(sass@1.85.0)(webpack@5.98.0) sass-loader: 16.0.5(sass@1.85.0)(webpack@5.98.0(esbuild@0.25.4))
semver: 7.7.1 semver: 7.7.1
source-map-loader: 5.0.0(webpack@5.98.0) source-map-loader: 5.0.0(webpack@5.98.0(esbuild@0.25.4))
source-map-support: 0.5.21 source-map-support: 0.5.21
terser: 5.39.0 terser: 5.39.0
tree-kill: 1.2.2 tree-kill: 1.2.2
tslib: 2.8.1 tslib: 2.8.1
typescript: 5.5.4 typescript: 5.5.4
webpack: 5.98.0(esbuild@0.25.4) webpack: 5.98.0(esbuild@0.25.4)
webpack-dev-middleware: 7.4.2(webpack@5.98.0) webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.4))
webpack-dev-server: 5.2.0(webpack@5.98.0) webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.4))
webpack-merge: 6.0.1 webpack-merge: 6.0.1
webpack-subresource-integrity: 5.1.0(webpack@5.98.0) webpack-subresource-integrity: 5.1.0(webpack@5.98.0(esbuild@0.25.4))
optionalDependencies: optionalDependencies:
'@angular/localize': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14) '@angular/localize': 19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(@angular/compiler@19.2.14)
esbuild: 0.25.4 esbuild: 0.25.4
@ -6273,12 +6270,12 @@ snapshots:
- webpack-cli - webpack-cli
- yaml - yaml
'@angular-devkit/build-webpack@0.1902.14(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0)': '@angular-devkit/build-webpack@0.1902.14(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.4)))(webpack@5.98.0(esbuild@0.25.4))':
dependencies: dependencies:
'@angular-devkit/architect': 0.1902.14(chokidar@4.0.3) '@angular-devkit/architect': 0.1902.14(chokidar@4.0.3)
rxjs: 7.8.1 rxjs: 7.8.1
webpack: 5.98.0(esbuild@0.25.4) webpack: 5.98.0(esbuild@0.25.4)
webpack-dev-server: 5.2.0(webpack@5.98.0) webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.4))
transitivePeerDependencies: transitivePeerDependencies:
- chokidar - chokidar
@ -8132,7 +8129,7 @@ snapshots:
rxjs: 7.8.2 rxjs: 7.8.2
tslib: 2.8.1 tslib: 2.8.1
'@ngtools/webpack@19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(typescript@5.5.4)(webpack@5.98.0)': '@ngtools/webpack@19.2.14(@angular/compiler-cli@19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4))(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4))':
dependencies: dependencies:
'@angular/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4) '@angular/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4)
typescript: 5.5.4 typescript: 5.5.4
@ -8931,7 +8928,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
babel-loader@9.2.1(@babel/core@7.26.10)(webpack@5.98.0): babel-loader@9.2.1(@babel/core@7.26.10)(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
'@babel/core': 7.26.10 '@babel/core': 7.26.10
find-cache-dir: 4.0.0 find-cache-dir: 4.0.0
@ -9266,7 +9263,7 @@ snapshots:
dependencies: dependencies:
is-what: 3.14.1 is-what: 3.14.1
copy-webpack-plugin@12.0.2(webpack@5.98.0): copy-webpack-plugin@12.0.2(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
fast-glob: 3.3.3 fast-glob: 3.3.3
glob-parent: 6.0.2 glob-parent: 6.0.2
@ -9314,7 +9311,7 @@ snapshots:
shebang-command: 2.0.0 shebang-command: 2.0.0
which: 2.0.2 which: 2.0.2
css-loader@7.1.2(webpack@5.98.0): css-loader@7.1.2(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
icss-utils: 5.1.0(postcss@8.5.2) icss-utils: 5.1.0(postcss@8.5.2)
postcss: 8.5.2 postcss: 8.5.2
@ -10771,7 +10768,7 @@ snapshots:
picocolors: 1.1.1 picocolors: 1.1.1
shell-quote: 1.8.3 shell-quote: 1.8.3
less-loader@12.2.0(less@4.2.2)(webpack@5.98.0): less-loader@12.2.0(less@4.2.2)(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
less: 4.2.2 less: 4.2.2
optionalDependencies: optionalDependencies:
@ -10798,7 +10795,7 @@ snapshots:
prelude-ls: 1.2.1 prelude-ls: 1.2.1
type-check: 0.4.0 type-check: 0.4.0
license-webpack-plugin@4.0.2(webpack@5.98.0): license-webpack-plugin@4.0.2(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
webpack-sources: 3.3.2 webpack-sources: 3.3.2
optionalDependencies: optionalDependencies:
@ -10966,7 +10963,7 @@ snapshots:
mimic-response@3.1.0: mimic-response@3.1.0:
optional: true optional: true
mini-css-extract-plugin@2.9.2(webpack@5.98.0): mini-css-extract-plugin@2.9.2(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
schema-utils: 4.3.2 schema-utils: 4.3.2
tapable: 2.2.2 tapable: 2.2.2
@ -11439,7 +11436,7 @@ snapshots:
optionalDependencies: optionalDependencies:
fsevents: 2.3.2 fsevents: 2.3.2
postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0): postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
cosmiconfig: 9.0.0(typescript@5.5.4) cosmiconfig: 9.0.0(typescript@5.5.4)
jiti: 1.21.7 jiti: 1.21.7
@ -11730,7 +11727,7 @@ snapshots:
safer-buffer@2.1.2: {} safer-buffer@2.1.2: {}
sass-loader@16.0.5(sass@1.85.0)(webpack@5.98.0): sass-loader@16.0.5(sass@1.85.0)(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
neo-async: 2.6.2 neo-async: 2.6.2
optionalDependencies: optionalDependencies:
@ -11933,7 +11930,7 @@ snapshots:
source-map-js@1.2.1: {} source-map-js@1.2.1: {}
source-map-loader@5.0.0(webpack@5.98.0): source-map-loader@5.0.0(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
iconv-lite: 0.6.3 iconv-lite: 0.6.3
source-map-js: 1.2.1 source-map-js: 1.2.1
@ -12105,7 +12102,7 @@ snapshots:
mkdirp: 3.0.1 mkdirp: 3.0.1
yallist: 5.0.0 yallist: 5.0.0
terser-webpack-plugin@5.3.14(esbuild@0.25.4)(webpack@5.98.0): terser-webpack-plugin@5.3.14(esbuild@0.25.4)(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
'@jridgewell/trace-mapping': 0.3.25 '@jridgewell/trace-mapping': 0.3.25
jest-worker: 27.5.1 jest-worker: 27.5.1
@ -12402,7 +12399,7 @@ snapshots:
webidl-conversions@7.0.0: {} webidl-conversions@7.0.0: {}
webpack-dev-middleware@7.4.2(webpack@5.98.0): webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
colorette: 2.0.20 colorette: 2.0.20
memfs: 4.17.2 memfs: 4.17.2
@ -12413,7 +12410,7 @@ snapshots:
optionalDependencies: optionalDependencies:
webpack: 5.98.0(esbuild@0.25.4) webpack: 5.98.0(esbuild@0.25.4)
webpack-dev-server@5.2.0(webpack@5.98.0): webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
'@types/bonjour': 3.5.13 '@types/bonjour': 3.5.13
'@types/connect-history-api-fallback': 1.5.4 '@types/connect-history-api-fallback': 1.5.4
@ -12440,7 +12437,7 @@ snapshots:
serve-index: 1.9.1 serve-index: 1.9.1
sockjs: 0.3.24 sockjs: 0.3.24
spdy: 4.0.2 spdy: 4.0.2
webpack-dev-middleware: 7.4.2(webpack@5.98.0) webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.4))
ws: 8.18.2 ws: 8.18.2
optionalDependencies: optionalDependencies:
webpack: 5.98.0(esbuild@0.25.4) webpack: 5.98.0(esbuild@0.25.4)
@ -12458,7 +12455,7 @@ snapshots:
webpack-sources@3.3.2: {} webpack-sources@3.3.2: {}
webpack-subresource-integrity@5.1.0(webpack@5.98.0): webpack-subresource-integrity@5.1.0(webpack@5.98.0(esbuild@0.25.4)):
dependencies: dependencies:
typed-assert: 1.0.9 typed-assert: 1.0.9
webpack: 5.98.0(esbuild@0.25.4) webpack: 5.98.0(esbuild@0.25.4)
@ -12487,7 +12484,7 @@ snapshots:
neo-async: 2.6.2 neo-async: 2.6.2
schema-utils: 4.3.2 schema-utils: 4.3.2
tapable: 2.2.2 tapable: 2.2.2
terser-webpack-plugin: 5.3.14(esbuild@0.25.4)(webpack@5.98.0) terser-webpack-plugin: 5.3.14(esbuild@0.25.4)(webpack@5.98.0(esbuild@0.25.4))
watchpack: 2.4.4 watchpack: 2.4.4
webpack-sources: 3.3.2 webpack-sources: 3.3.2
transitivePeerDependencies: transitivePeerDependencies:

View File

@ -16,15 +16,15 @@ from django.utils.translation import gettext_lazy as _
from dotenv import load_dotenv from dotenv import load_dotenv
# Tap paperless.conf if it's available # Tap paperless.conf if it's available
for path in [ configuration_path = os.getenv("PAPERLESS_CONFIGURATION_PATH")
os.getenv("PAPERLESS_CONFIGURATION_PATH"), if configuration_path and os.path.exists(configuration_path):
"../paperless.conf", load_dotenv(configuration_path)
"/etc/paperless.conf", elif os.path.exists("../paperless.conf"):
"/usr/local/etc/paperless.conf", load_dotenv("../paperless.conf")
]: elif os.path.exists("/etc/paperless.conf"):
if path and Path(path).exists(): load_dotenv("/etc/paperless.conf")
load_dotenv(path) elif os.path.exists("/usr/local/etc/paperless.conf"):
break load_dotenv("/usr/local/etc/paperless.conf")
# There are multiple levels of concurrency in paperless: # There are multiple levels of concurrency in paperless:
# - Multiple consumers may be run in parallel. # - Multiple consumers may be run in parallel.
@ -674,7 +674,7 @@ def _parse_db_settings() -> dict:
databases = { databases = {
"default": { "default": {
"ENGINE": "django.db.backends.sqlite3", "ENGINE": "django.db.backends.sqlite3",
"NAME": str(DATA_DIR / "db.sqlite3"), "NAME": os.path.join(DATA_DIR, "db.sqlite3"),
"OPTIONS": {}, "OPTIONS": {},
}, },
} }
@ -789,7 +789,7 @@ LANGUAGES = [
("zh-tw", _("Chinese Traditional")), ("zh-tw", _("Chinese Traditional")),
] ]
LOCALE_PATHS = [str(BASE_DIR / "locale")] LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
TIME_ZONE = os.getenv("PAPERLESS_TIME_ZONE", "UTC") TIME_ZONE = os.getenv("PAPERLESS_TIME_ZONE", "UTC")
@ -832,21 +832,21 @@ LOGGING = {
"file_paperless": { "file_paperless": {
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler", "class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
"formatter": "verbose", "formatter": "verbose",
"filename": str(LOGGING_DIR / "paperless.log"), "filename": os.path.join(LOGGING_DIR, "paperless.log"),
"maxBytes": LOGROTATE_MAX_SIZE, "maxBytes": LOGROTATE_MAX_SIZE,
"backupCount": LOGROTATE_MAX_BACKUPS, "backupCount": LOGROTATE_MAX_BACKUPS,
}, },
"file_mail": { "file_mail": {
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler", "class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
"formatter": "verbose", "formatter": "verbose",
"filename": str(LOGGING_DIR / "mail.log"), "filename": os.path.join(LOGGING_DIR, "mail.log"),
"maxBytes": LOGROTATE_MAX_SIZE, "maxBytes": LOGROTATE_MAX_SIZE,
"backupCount": LOGROTATE_MAX_BACKUPS, "backupCount": LOGROTATE_MAX_BACKUPS,
}, },
"file_celery": { "file_celery": {
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler", "class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
"formatter": "verbose", "formatter": "verbose",
"filename": str(LOGGING_DIR / "celery.log"), "filename": os.path.join(LOGGING_DIR, "celery.log"),
"maxBytes": LOGROTATE_MAX_SIZE, "maxBytes": LOGROTATE_MAX_SIZE,
"backupCount": LOGROTATE_MAX_BACKUPS, "backupCount": LOGROTATE_MAX_BACKUPS,
}, },
@ -901,7 +901,7 @@ CELERY_ACCEPT_CONTENT = ["application/json", "application/x-python-serialize"]
CELERY_BEAT_SCHEDULE = _parse_beat_schedule() CELERY_BEAT_SCHEDULE = _parse_beat_schedule()
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-schedule-filename # https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-schedule-filename
CELERY_BEAT_SCHEDULE_FILENAME = str(DATA_DIR / "celerybeat-schedule.db") CELERY_BEAT_SCHEDULE_FILENAME = os.path.join(DATA_DIR, "celerybeat-schedule.db")
# django setting. # django setting.
CACHES = { CACHES = {

View File

@ -125,8 +125,3 @@ class MailRuleSerializer(OwnedObjectSerializer):
raise serializers.ValidationError("An action parameter is required.") raise serializers.ValidationError("An action parameter is required.")
return attrs return attrs
def validate_maximum_age(self, value):
if value > 36500: # ~100 years
raise serializers.ValidationError("Maximum mail age is unreasonably large.")
return value

View File

@ -680,44 +680,3 @@ class TestAPIMailRules(DirectoriesMixin, APITestCase):
self.assertEqual(response.data["results"][0]["name"], rule1.name) self.assertEqual(response.data["results"][0]["name"], rule1.name)
self.assertEqual(response.data["results"][1]["name"], rule2.name) self.assertEqual(response.data["results"][1]["name"], rule2.name)
self.assertEqual(response.data["results"][2]["name"], rule4.name) self.assertEqual(response.data["results"][2]["name"], rule4.name)
def test_mailrule_maxage_validation(self):
"""
GIVEN:
- An existing mail account
WHEN:
- The user submits a mail rule with an excessively large maximum_age
THEN:
- The API should reject the request
"""
account = MailAccount.objects.create(
name="Email1",
username="username1",
password="password1",
imap_server="server.example.com",
imap_port=443,
imap_security=MailAccount.ImapSecurity.SSL,
character_set="UTF-8",
)
rule_data = {
"name": "Rule1",
"account": account.pk,
"folder": "INBOX",
"filter_from": "from@example.com",
"filter_to": "aperson@aplace.com",
"filter_subject": "subject",
"filter_body": "body",
"filter_attachment_filename_include": "file.pdf",
"maximum_age": 9000000,
"action": MailRule.MailAction.MARK_READ,
"assign_title_from": MailRule.TitleSource.FROM_SUBJECT,
"assign_correspondent_from": MailRule.CorrespondentSource.FROM_NOTHING,
"order": 0,
"attachment_type": MailRule.AttachmentProcessing.ATTACHMENTS_ONLY,
}
response = self.client.post(self.ENDPOINT, data=rule_data, format="json")
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn("maximum_age", response.data)