Skip to content

Commit 1572713

Browse files
author
Andrei Neagu
committed
using shared value
1 parent 2f72676 commit 1572713

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

services/storage/src/simcore_service_storage/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@
4141

4242

4343
EXPAND_DIR_MAX_ITEM_COUNT: Final[int] = 1000
44+
45+
46+
EXPORTS_S3_PREFIX: Final[str] = "exports"

services/storage/src/simcore_service_storage/modules/db/access_layer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
from simcore_postgres_database.utils_sql import assemble_array_groups
5454
from sqlalchemy.ext.asyncio import AsyncConnection
5555

56+
from ...constants import EXPORTS_S3_PREFIX
5657
from ...exceptions.errors import InvalidFileIdentifierError
5758
from ...models import AccessRights
5859
from ._base import BaseRepository
@@ -335,7 +336,7 @@ async def get_file_access_rights( # pylint:disable=too-many-return-statements #
335336
# ownership still not defined, so we assume it is user_id
336337
return AccessRights.all()
337338

338-
if parent == "exports":
339+
if parent == EXPORTS_S3_PREFIX:
339340
# ownership still not defined, so we assume it is user_id
340341
return AccessRights.all()
341342

services/storage/src/simcore_service_storage/utils/simcore_s3_dsm_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from servicelib.utils import ensure_ends_with
2121
from sqlalchemy.ext.asyncio import AsyncEngine
2222

23+
from ..constants import EXPORTS_S3_PREFIX
2324
from ..exceptions.errors import FileMetaDataNotFoundError, ProjectAccessRightError
2425
from ..models import FileMetaData, FileMetaDataAtDB, GenericCursor, PathMetaData
2526
from ..modules.db.access_layer import AccessLayerRepository
@@ -138,7 +139,7 @@ def compute_file_id_prefix(file_id: str, levels: int):
138139

139140
def get_random_export_name(user_id: UserID) -> StorageFileID:
140141
return TypeAdapter(StorageFileID).validate_python(
141-
f"exports/{user_id}/{uuid4()}.zip"
142+
f"{EXPORTS_S3_PREFIX}/{user_id}/{uuid4()}.zip"
142143
)
143144

144145

0 commit comments

Comments
 (0)