@hmcts/ccd-case-ui-toolkit 7.4.11 → 7.4.12-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.
|
@@ -14834,7 +14834,7 @@ class CaseFileViewFieldComponent {
|
|
|
14834
14834
|
}
|
|
14835
14835
|
setMediaViewerFile(document) {
|
|
14836
14836
|
const documentDetails = {
|
|
14837
|
-
document_binary_url: document
|
|
14837
|
+
document_binary_url: this.withLegacyDocumentAccessContext(this.documentManagementService.getDocumentBinaryUrl(document)),
|
|
14838
14838
|
document_filename: document.document_filename,
|
|
14839
14839
|
content_type: document.content_type
|
|
14840
14840
|
};
|
|
@@ -14849,6 +14849,19 @@ class CaseFileViewFieldComponent {
|
|
|
14849
14849
|
const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
|
|
14850
14850
|
this.currentDocument = JSON.parse(mediaViewerInfo);
|
|
14851
14851
|
}
|
|
14852
|
+
withLegacyDocumentAccessContext(documentBinaryUrl) {
|
|
14853
|
+
if (!documentBinaryUrl || !this.caseId) {
|
|
14854
|
+
return documentBinaryUrl;
|
|
14855
|
+
}
|
|
14856
|
+
const [path, query = ''] = documentBinaryUrl.split('?');
|
|
14857
|
+
if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
|
|
14858
|
+
return documentBinaryUrl;
|
|
14859
|
+
}
|
|
14860
|
+
// XUI validates legacy document access against the case before proxying the binary request.
|
|
14861
|
+
const searchParams = new URLSearchParams(query);
|
|
14862
|
+
searchParams.set('caseId', this.caseId);
|
|
14863
|
+
return `${path}?${searchParams.toString()}`;
|
|
14864
|
+
}
|
|
14852
14865
|
moveDocument(data) {
|
|
14853
14866
|
const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
|
|
14854
14867
|
const loadingToken = this.loadingService.register();
|