dify/api/models
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
..
__init__.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
_workflow_exc.py feat: Persist Variables for Enhanced Debugging Workflow (#20699) 2025-06-24 09:05:29 +08:00
account.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
api_based_extension.py replace db with sa to get typing support (#23240) 2025-08-02 23:54:23 +08:00
base.py example add more type check (#24999) 2025-09-02 19:13:43 +08:00
dataset.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
engine.py feat(api): Add image multimodal support for LLMNode (#17372) 2025-04-30 17:28:02 +08:00
enums.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
model.py Fix: correct regex for file-preview URL re-signing (#25620) 2025-09-22 10:58:29 +08:00
oauth.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
provider.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
provider_ids.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
source.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
task.py chore: add ast-grep rule to convert Optional[T] to T | None (#25560) 2025-09-15 13:06:33 +08:00
tools.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00
types.py [Chore/Refactor] Improve type annotations in models module (#25281) 2025-09-08 09:42:27 +08:00
web.py replace db with sa to get typing support (#23240) 2025-08-02 23:54:23 +08:00
workflow.py feat: knowledge pipeline (#25360) 2025-09-18 12:49:10 +08:00