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

[MDS-5737] Fixed incosistent path on new file uploads #2898

Merged
merged 1 commit into from
Jan 18, 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 @@ -203,9 +203,12 @@ def parse_and_validate_uploaded_file(cls, data):
def complete_multipart_upload(cls, upload_id, parts, document, version=None):
ObjectStoreStorageService().complete_multipart_upload(upload_id, document.multipart_upload_path, parts)

# File has been uploaded to S3 in the {Config.S3_PREFIX}/multipart folder, now move it to its final destination
key_prefix = Config.S3_PREFIX[:-1] if Config.S3_PREFIX and Config.S3_PREFIX !='/' else ''
upload_destination_path = f'{key_prefix}{document.full_storage_path}'
return cls.complete_upload(
key=document.multipart_upload_path,
new_key=document.full_storage_path,
new_key=upload_destination_path,
doc_guid=str(document.document_guid),
versions=None,
version_guid=str(version.id) if version is not None else None,
Expand All @@ -219,9 +222,8 @@ def complete_upload(cls, key, new_key, doc_guid, versions=None, version_guid=Non

# Copy the file to its new location
try:
key_prefix = Config.S3_PREFIX[:-1] if Config.S3_PREFIX and Config.S3_PREFIX !='/' else ''

oss.copy_file(source_key=key, key=key_prefix + new_key)
oss.copy_file(source_key=key, key=new_key)

if version_guid is not None and versions is None:
versions = oss.list_versions(new_key)['Versions']
Expand Down
2 changes: 1 addition & 1 deletion services/filesystem-provider/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ S3_PREFIX=/

SYNCFUSION_LICENSE_KEY=

JWT_OIDC_AUTHORITY=https://test.loginproxy.gov.bc.ca/auth/realms/standard/.well-known/openid-configuration
JWT_OIDC_AUTHORITY=https://test.loginproxy.gov.bc.ca/auth/realms/standard/
JWT_OIDC_AUDIENCE=mines-digital-services-mds-public-client-4414
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export const DocumentTable: FC<DocumentTableProps> = ({
label: FileOperations.View,
icon: <FileOutlined />,
clickFunction: (_event, record: MineDocument) =>
openDocument(record.document_manager_guid, record.mine_document_guid),
openDocument(record.document_manager_guid, record.document_name),
},
{
key: "download",
Expand Down
Loading