Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix v0.2048.1 #292

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

from dl_constants.enums import FileProcessingStatus
from dl_file_uploader_lib.enums import FileType
from dl_file_uploader_lib.exc import InvalidLink
from dl_file_uploader_lib.exc import (
InvalidLink,
YaDocsInvalidLinkPrefix,
)
from dl_file_uploader_lib.redis_model.base import RedisModelManager
from dl_file_uploader_lib.redis_model.models import DataFile
from dl_file_uploader_lib.redis_model.models.models import (
Expand Down Expand Up @@ -84,7 +87,9 @@ async def yadocs_data_file_preparer(
path = parts.path
prefix = "/i/"
if not path.startswith(prefix):
raise InvalidLink(f"Invalid URL path prefix: {path!r}; should be {prefix!r}; {example_url_message}")
raise YaDocsInvalidLinkPrefix(
f"Invalid URL path prefix: {path!r}; should be {prefix!r}; {example_url_message}"
)

df = DataFile(
manager=redis_model_manager,
Expand Down
5 changes: 5 additions & 0 deletions lib/dl_file_uploader_lib/dl_file_uploader_lib/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class InvalidLink(DLFileUploaderBaseError):
default_message = "Invalid format link provided"


class YaDocsInvalidLinkPrefix(InvalidLink):
err_code = InvalidLink.err_code + ["YADOCS_INVALID_PUBLIC_LINK_PREFIX"]
default_message = "Invalid url path prefix"


class EmptyDocument(DLFileUploaderBaseError):
err_code = DLFileUploaderBaseError.err_code + ["NO_DATA"]
default_message = "Empty document"
Expand Down
Loading