dify/api/tests/unit_tests
Yongtao Huang 5bc6e8a433
Fix: correct regex for file-preview URL re-signing (#25620)
Fixes #25619

The regex patterns for file-preview and image-preview contained an unescaped `?`, 
which caused incorrect matches such as `file-previe` or `image-previw`. 
This led to malformed URLs being incorrectly re-signed.

Changes:
- Escape `?` in both file-preview and image-preview regex patterns.
- Ensure only valid URLs are re-signed.

Added unit tests to cover:
- Valid file-preview and image-preview URLs (correctly re-signed).
- Misspelled file/image preview URLs (no longer incorrectly matched).

Other:
- Fix a deprecated function `datetime.utcnow()`

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
2025-09-22 10:58:29 +08:00
..
configs feat: make SQLALCHEMY_POOL_TIMEOUT configurable (#25468) 2025-09-18 16:13:56 +08:00
controllers feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
core Fix: correct regex for file-preview URL re-signing (#25620) 2025-09-22 10:58:29 +08:00
extensions use autospec=True in mock (#25497) 2025-09-12 09:46:02 +08:00
factories feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
libs chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
models Fix: correct regex for file-preview URL re-signing (#25620) 2025-09-22 10:58:29 +08:00
oss chore: improve opendal storage and ensure closing file after reading files in `load_stream` method (#25874) 2025-09-18 14:09:19 +08:00
repositories feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
services fix: handle None description in MCP tool transformation (#25872) 2025-09-18 13:11:38 +08:00
tasks feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
utils feat(stress-test): add comprehensive stress testing suite using Locust (#25617) 2025-09-12 22:25:05 +08:00
.gitignore Enhance Code Consistency Across Repository with `.editorconfig` (#19023) 2025-04-29 18:04:33 +08:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
conftest.py fix: resolve Redis mock import error in test configuration (#22663) 2025-07-20 11:06:38 +08:00