mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-06-26 15:44:47 -05:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
37267f3f04 | ||
![]() |
b34538d991 | ||
![]() |
fc97bd1315 | ||
![]() |
dbf3721ec2 | ||
![]() |
59afbe09b1 | ||
![]() |
bfeaa1b119 | ||
![]() |
e1c3124698 |
55
.github/DISCUSSION_TEMPLATE/support.yml
vendored
Normal file
55
.github/DISCUSSION_TEMPLATE/support.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
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
|
@ -1,5 +1,15 @@
|
||||
# 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
|
||||
|
||||
### Breaking Changes
|
||||
@ -5997,7 +6007,6 @@ primarily.
|
||||
a very good job at ocr'ing a document with the default
|
||||
language. Certain language specifics such as umlauts may not get
|
||||
picked up properly.
|
||||
- `PAPERLESS_DEBUG` defaults to `false`.
|
||||
- The presence of `PAPERLESS_DBHOST` now determines whether to use
|
||||
PostgreSQL or SQLite.
|
||||
- `PAPERLESS_OCR_THREADS` is gone and replaced with
|
||||
|
@ -1,10 +1,6 @@
|
||||
# Have a look at the docs for documentation.
|
||||
# https://docs.paperless-ngx.com/configuration/
|
||||
|
||||
# Debug. Only enable this for development.
|
||||
|
||||
#PAPERLESS_DEBUG=false
|
||||
|
||||
# Required services
|
||||
|
||||
#PAPERLESS_REDIS=redis://localhost:6379
|
||||
|
@ -221,9 +221,6 @@ lint.per-file-ignores."src/documents/parsers.py" = [
|
||||
lint.per-file-ignores."src/documents/signals/handlers.py" = [
|
||||
"PTH",
|
||||
] # 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" = [
|
||||
"RUF001",
|
||||
]
|
||||
|
@ -67,7 +67,8 @@
|
||||
"jest-websocket-mock": "^2.5.0",
|
||||
"prettier-plugin-organize-imports": "^4.1.0",
|
||||
"ts-node": "~10.9.1",
|
||||
"typescript": "^5.5.4"
|
||||
"typescript": "^5.5.4",
|
||||
"webpack": "^5.98.0"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
|
67
src-ui/pnpm-lock.yaml
generated
67
src-ui/pnpm-lock.yaml
generated
@ -174,6 +174,9 @@ importers:
|
||||
typescript:
|
||||
specifier: ^5.5.4
|
||||
version: 5.5.4
|
||||
webpack:
|
||||
specifier: ^5.98.0
|
||||
version: 5.98.0(esbuild@0.25.4)
|
||||
|
||||
packages:
|
||||
|
||||
@ -6187,7 +6190,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@ampproject/remapping': 2.3.0
|
||||
'@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(esbuild@0.25.4)))(webpack@5.98.0(esbuild@0.25.4))
|
||||
'@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/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/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4)
|
||||
@ -6201,14 +6204,14 @@ snapshots:
|
||||
'@babel/preset-env': 7.26.9(@babel/core@7.26.10)
|
||||
'@babel/runtime': 7.26.10
|
||||
'@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(esbuild@0.25.4))
|
||||
'@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)
|
||||
'@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
|
||||
autoprefixer: 10.4.20(postcss@8.5.2)
|
||||
babel-loader: 9.2.1(@babel/core@7.26.10)(webpack@5.98.0(esbuild@0.25.4))
|
||||
babel-loader: 9.2.1(@babel/core@7.26.10)(webpack@5.98.0)
|
||||
browserslist: 4.25.0
|
||||
copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.4))
|
||||
css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.4))
|
||||
copy-webpack-plugin: 12.0.2(webpack@5.98.0)
|
||||
css-loader: 7.1.2(webpack@5.98.0)
|
||||
esbuild-wasm: 0.25.4
|
||||
fast-glob: 3.3.3
|
||||
http-proxy-middleware: 3.0.5
|
||||
@ -6216,32 +6219,32 @@ snapshots:
|
||||
jsonc-parser: 3.3.1
|
||||
karma-source-map-support: 1.4.0
|
||||
less: 4.2.2
|
||||
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(esbuild@0.25.4))
|
||||
less-loader: 12.2.0(less@4.2.2)(webpack@5.98.0)
|
||||
license-webpack-plugin: 4.0.2(webpack@5.98.0)
|
||||
loader-utils: 3.3.1
|
||||
mini-css-extract-plugin: 2.9.2(webpack@5.98.0(esbuild@0.25.4))
|
||||
mini-css-extract-plugin: 2.9.2(webpack@5.98.0)
|
||||
open: 10.1.0
|
||||
ora: 5.4.1
|
||||
picomatch: 4.0.2
|
||||
piscina: 4.8.0
|
||||
postcss: 8.5.2
|
||||
postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4))
|
||||
postcss-loader: 8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0)
|
||||
resolve-url-loader: 5.0.0
|
||||
rxjs: 7.8.1
|
||||
sass: 1.85.0
|
||||
sass-loader: 16.0.5(sass@1.85.0)(webpack@5.98.0(esbuild@0.25.4))
|
||||
sass-loader: 16.0.5(sass@1.85.0)(webpack@5.98.0)
|
||||
semver: 7.7.1
|
||||
source-map-loader: 5.0.0(webpack@5.98.0(esbuild@0.25.4))
|
||||
source-map-loader: 5.0.0(webpack@5.98.0)
|
||||
source-map-support: 0.5.21
|
||||
terser: 5.39.0
|
||||
tree-kill: 1.2.2
|
||||
tslib: 2.8.1
|
||||
typescript: 5.5.4
|
||||
webpack: 5.98.0(esbuild@0.25.4)
|
||||
webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.4))
|
||||
webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.4))
|
||||
webpack-dev-middleware: 7.4.2(webpack@5.98.0)
|
||||
webpack-dev-server: 5.2.0(webpack@5.98.0)
|
||||
webpack-merge: 6.0.1
|
||||
webpack-subresource-integrity: 5.1.0(webpack@5.98.0(esbuild@0.25.4))
|
||||
webpack-subresource-integrity: 5.1.0(webpack@5.98.0)
|
||||
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)
|
||||
esbuild: 0.25.4
|
||||
@ -6270,12 +6273,12 @@ snapshots:
|
||||
- webpack-cli
|
||||
- yaml
|
||||
|
||||
'@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/build-webpack@0.1902.14(chokidar@4.0.3)(webpack-dev-server@5.2.0(webpack@5.98.0))(webpack@5.98.0)':
|
||||
dependencies:
|
||||
'@angular-devkit/architect': 0.1902.14(chokidar@4.0.3)
|
||||
rxjs: 7.8.1
|
||||
webpack: 5.98.0(esbuild@0.25.4)
|
||||
webpack-dev-server: 5.2.0(webpack@5.98.0(esbuild@0.25.4))
|
||||
webpack-dev-server: 5.2.0(webpack@5.98.0)
|
||||
transitivePeerDependencies:
|
||||
- chokidar
|
||||
|
||||
@ -8129,7 +8132,7 @@ snapshots:
|
||||
rxjs: 7.8.2
|
||||
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(esbuild@0.25.4))':
|
||||
'@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)':
|
||||
dependencies:
|
||||
'@angular/compiler-cli': 19.2.14(@angular/compiler@19.2.14)(typescript@5.5.4)
|
||||
typescript: 5.5.4
|
||||
@ -8928,7 +8931,7 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
babel-loader@9.2.1(@babel/core@7.26.10)(webpack@5.98.0(esbuild@0.25.4)):
|
||||
babel-loader@9.2.1(@babel/core@7.26.10)(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@babel/core': 7.26.10
|
||||
find-cache-dir: 4.0.0
|
||||
@ -9263,7 +9266,7 @@ snapshots:
|
||||
dependencies:
|
||||
is-what: 3.14.1
|
||||
|
||||
copy-webpack-plugin@12.0.2(webpack@5.98.0(esbuild@0.25.4)):
|
||||
copy-webpack-plugin@12.0.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
fast-glob: 3.3.3
|
||||
glob-parent: 6.0.2
|
||||
@ -9311,7 +9314,7 @@ snapshots:
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
css-loader@7.1.2(webpack@5.98.0(esbuild@0.25.4)):
|
||||
css-loader@7.1.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
icss-utils: 5.1.0(postcss@8.5.2)
|
||||
postcss: 8.5.2
|
||||
@ -10768,7 +10771,7 @@ snapshots:
|
||||
picocolors: 1.1.1
|
||||
shell-quote: 1.8.3
|
||||
|
||||
less-loader@12.2.0(less@4.2.2)(webpack@5.98.0(esbuild@0.25.4)):
|
||||
less-loader@12.2.0(less@4.2.2)(webpack@5.98.0):
|
||||
dependencies:
|
||||
less: 4.2.2
|
||||
optionalDependencies:
|
||||
@ -10795,7 +10798,7 @@ snapshots:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
|
||||
license-webpack-plugin@4.0.2(webpack@5.98.0(esbuild@0.25.4)):
|
||||
license-webpack-plugin@4.0.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
webpack-sources: 3.3.2
|
||||
optionalDependencies:
|
||||
@ -10963,7 +10966,7 @@ snapshots:
|
||||
mimic-response@3.1.0:
|
||||
optional: true
|
||||
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.98.0(esbuild@0.25.4)):
|
||||
mini-css-extract-plugin@2.9.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
schema-utils: 4.3.2
|
||||
tapable: 2.2.2
|
||||
@ -11436,7 +11439,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
|
||||
postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0(esbuild@0.25.4)):
|
||||
postcss-loader@8.1.1(postcss@8.5.2)(typescript@5.5.4)(webpack@5.98.0):
|
||||
dependencies:
|
||||
cosmiconfig: 9.0.0(typescript@5.5.4)
|
||||
jiti: 1.21.7
|
||||
@ -11727,7 +11730,7 @@ snapshots:
|
||||
|
||||
safer-buffer@2.1.2: {}
|
||||
|
||||
sass-loader@16.0.5(sass@1.85.0)(webpack@5.98.0(esbuild@0.25.4)):
|
||||
sass-loader@16.0.5(sass@1.85.0)(webpack@5.98.0):
|
||||
dependencies:
|
||||
neo-async: 2.6.2
|
||||
optionalDependencies:
|
||||
@ -11930,7 +11933,7 @@ snapshots:
|
||||
|
||||
source-map-js@1.2.1: {}
|
||||
|
||||
source-map-loader@5.0.0(webpack@5.98.0(esbuild@0.25.4)):
|
||||
source-map-loader@5.0.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
iconv-lite: 0.6.3
|
||||
source-map-js: 1.2.1
|
||||
@ -12102,7 +12105,7 @@ snapshots:
|
||||
mkdirp: 3.0.1
|
||||
yallist: 5.0.0
|
||||
|
||||
terser-webpack-plugin@5.3.14(esbuild@0.25.4)(webpack@5.98.0(esbuild@0.25.4)):
|
||||
terser-webpack-plugin@5.3.14(esbuild@0.25.4)(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
jest-worker: 27.5.1
|
||||
@ -12399,7 +12402,7 @@ snapshots:
|
||||
|
||||
webidl-conversions@7.0.0: {}
|
||||
|
||||
webpack-dev-middleware@7.4.2(webpack@5.98.0(esbuild@0.25.4)):
|
||||
webpack-dev-middleware@7.4.2(webpack@5.98.0):
|
||||
dependencies:
|
||||
colorette: 2.0.20
|
||||
memfs: 4.17.2
|
||||
@ -12410,7 +12413,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
webpack: 5.98.0(esbuild@0.25.4)
|
||||
|
||||
webpack-dev-server@5.2.0(webpack@5.98.0(esbuild@0.25.4)):
|
||||
webpack-dev-server@5.2.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
'@types/bonjour': 3.5.13
|
||||
'@types/connect-history-api-fallback': 1.5.4
|
||||
@ -12437,7 +12440,7 @@ snapshots:
|
||||
serve-index: 1.9.1
|
||||
sockjs: 0.3.24
|
||||
spdy: 4.0.2
|
||||
webpack-dev-middleware: 7.4.2(webpack@5.98.0(esbuild@0.25.4))
|
||||
webpack-dev-middleware: 7.4.2(webpack@5.98.0)
|
||||
ws: 8.18.2
|
||||
optionalDependencies:
|
||||
webpack: 5.98.0(esbuild@0.25.4)
|
||||
@ -12455,7 +12458,7 @@ snapshots:
|
||||
|
||||
webpack-sources@3.3.2: {}
|
||||
|
||||
webpack-subresource-integrity@5.1.0(webpack@5.98.0(esbuild@0.25.4)):
|
||||
webpack-subresource-integrity@5.1.0(webpack@5.98.0):
|
||||
dependencies:
|
||||
typed-assert: 1.0.9
|
||||
webpack: 5.98.0(esbuild@0.25.4)
|
||||
@ -12484,7 +12487,7 @@ snapshots:
|
||||
neo-async: 2.6.2
|
||||
schema-utils: 4.3.2
|
||||
tapable: 2.2.2
|
||||
terser-webpack-plugin: 5.3.14(esbuild@0.25.4)(webpack@5.98.0(esbuild@0.25.4))
|
||||
terser-webpack-plugin: 5.3.14(esbuild@0.25.4)(webpack@5.98.0)
|
||||
watchpack: 2.4.4
|
||||
webpack-sources: 3.3.2
|
||||
transitivePeerDependencies:
|
||||
|
@ -16,15 +16,15 @@ from django.utils.translation import gettext_lazy as _
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Tap paperless.conf if it's available
|
||||
configuration_path = os.getenv("PAPERLESS_CONFIGURATION_PATH")
|
||||
if configuration_path and os.path.exists(configuration_path):
|
||||
load_dotenv(configuration_path)
|
||||
elif os.path.exists("../paperless.conf"):
|
||||
load_dotenv("../paperless.conf")
|
||||
elif os.path.exists("/etc/paperless.conf"):
|
||||
load_dotenv("/etc/paperless.conf")
|
||||
elif os.path.exists("/usr/local/etc/paperless.conf"):
|
||||
load_dotenv("/usr/local/etc/paperless.conf")
|
||||
for path in [
|
||||
os.getenv("PAPERLESS_CONFIGURATION_PATH"),
|
||||
"../paperless.conf",
|
||||
"/etc/paperless.conf",
|
||||
"/usr/local/etc/paperless.conf",
|
||||
]:
|
||||
if path and Path(path).exists():
|
||||
load_dotenv(path)
|
||||
break
|
||||
|
||||
# There are multiple levels of concurrency in paperless:
|
||||
# - Multiple consumers may be run in parallel.
|
||||
@ -674,7 +674,7 @@ def _parse_db_settings() -> dict:
|
||||
databases = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(DATA_DIR, "db.sqlite3"),
|
||||
"NAME": str(DATA_DIR / "db.sqlite3"),
|
||||
"OPTIONS": {},
|
||||
},
|
||||
}
|
||||
@ -789,7 +789,7 @@ LANGUAGES = [
|
||||
("zh-tw", _("Chinese Traditional")),
|
||||
]
|
||||
|
||||
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
|
||||
LOCALE_PATHS = [str(BASE_DIR / "locale")]
|
||||
|
||||
TIME_ZONE = os.getenv("PAPERLESS_TIME_ZONE", "UTC")
|
||||
|
||||
@ -832,21 +832,21 @@ LOGGING = {
|
||||
"file_paperless": {
|
||||
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
|
||||
"formatter": "verbose",
|
||||
"filename": os.path.join(LOGGING_DIR, "paperless.log"),
|
||||
"filename": str(LOGGING_DIR / "paperless.log"),
|
||||
"maxBytes": LOGROTATE_MAX_SIZE,
|
||||
"backupCount": LOGROTATE_MAX_BACKUPS,
|
||||
},
|
||||
"file_mail": {
|
||||
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
|
||||
"formatter": "verbose",
|
||||
"filename": os.path.join(LOGGING_DIR, "mail.log"),
|
||||
"filename": str(LOGGING_DIR / "mail.log"),
|
||||
"maxBytes": LOGROTATE_MAX_SIZE,
|
||||
"backupCount": LOGROTATE_MAX_BACKUPS,
|
||||
},
|
||||
"file_celery": {
|
||||
"class": "concurrent_log_handler.ConcurrentRotatingFileHandler",
|
||||
"formatter": "verbose",
|
||||
"filename": os.path.join(LOGGING_DIR, "celery.log"),
|
||||
"filename": str(LOGGING_DIR / "celery.log"),
|
||||
"maxBytes": LOGROTATE_MAX_SIZE,
|
||||
"backupCount": LOGROTATE_MAX_BACKUPS,
|
||||
},
|
||||
@ -901,7 +901,7 @@ CELERY_ACCEPT_CONTENT = ["application/json", "application/x-python-serialize"]
|
||||
CELERY_BEAT_SCHEDULE = _parse_beat_schedule()
|
||||
|
||||
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#beat-schedule-filename
|
||||
CELERY_BEAT_SCHEDULE_FILENAME = os.path.join(DATA_DIR, "celerybeat-schedule.db")
|
||||
CELERY_BEAT_SCHEDULE_FILENAME = str(DATA_DIR / "celerybeat-schedule.db")
|
||||
|
||||
# django setting.
|
||||
CACHES = {
|
||||
|
@ -125,3 +125,8 @@ class MailRuleSerializer(OwnedObjectSerializer):
|
||||
raise serializers.ValidationError("An action parameter is required.")
|
||||
|
||||
return attrs
|
||||
|
||||
def validate_maximum_age(self, value):
|
||||
if value > 36500: # ~100 years
|
||||
raise serializers.ValidationError("Maximum mail age is unreasonably large.")
|
||||
return value
|
||||
|
@ -680,3 +680,44 @@ class TestAPIMailRules(DirectoriesMixin, APITestCase):
|
||||
self.assertEqual(response.data["results"][0]["name"], rule1.name)
|
||||
self.assertEqual(response.data["results"][1]["name"], rule2.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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user