@hmcts/ccd-case-ui-toolkit 7.4.17 → 7.4.18-broken-access
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14874,7 +14874,7 @@ class CaseFileViewFieldComponent {
|
|
|
14874
14874
|
}
|
|
14875
14875
|
setMediaViewerFile(document) {
|
|
14876
14876
|
const documentDetails = {
|
|
14877
|
-
document_binary_url: document
|
|
14877
|
+
document_binary_url: this.withLegacyDocumentAccessContext(this.documentManagementService.getDocumentBinaryUrl(document)),
|
|
14878
14878
|
document_filename: document.document_filename,
|
|
14879
14879
|
content_type: document.content_type
|
|
14880
14880
|
};
|
|
@@ -14889,6 +14889,19 @@ class CaseFileViewFieldComponent {
|
|
|
14889
14889
|
const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
|
|
14890
14890
|
this.currentDocument = JSON.parse(mediaViewerInfo);
|
|
14891
14891
|
}
|
|
14892
|
+
withLegacyDocumentAccessContext(documentBinaryUrl) {
|
|
14893
|
+
if (!documentBinaryUrl || !this.caseId) {
|
|
14894
|
+
return documentBinaryUrl;
|
|
14895
|
+
}
|
|
14896
|
+
const [path, query = ''] = documentBinaryUrl.split('?');
|
|
14897
|
+
if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
|
|
14898
|
+
return documentBinaryUrl;
|
|
14899
|
+
}
|
|
14900
|
+
// XUI validates legacy document access against the case before proxying the binary request.
|
|
14901
|
+
const searchParams = new URLSearchParams(query);
|
|
14902
|
+
searchParams.set('caseId', this.caseId);
|
|
14903
|
+
return `${path}?${searchParams.toString()}`;
|
|
14904
|
+
}
|
|
14892
14905
|
moveDocument(data) {
|
|
14893
14906
|
const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
|
|
14894
14907
|
const loadingToken = this.loadingService.register();
|