优化
This commit is contained in:
@@ -165,9 +165,15 @@ export function downloadContainerDocument(containerId: string, documentType: Ext
|
||||
return http.get<Blob, Blob>(`${containerPath}/${encodeURIComponent(containerId)}/documents/${documentType}/${encodeURIComponent(fileId)}/download`, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
function normalizeContainerPhotoDownloadPath(downloadPath: string) {
|
||||
if (typeof downloadPath !== 'string' || !downloadPath.startsWith('/')) throw new Error('invalid container photo path')
|
||||
const normalized = downloadPath.startsWith('/api/') ? downloadPath.slice(4) : downloadPath
|
||||
if (!/^\/platform\/v1\/containers\/[1-9][0-9]*\/pda\/photos\/[1-9][0-9]*\/download$/.test(normalized)) throw new Error('invalid container photo path')
|
||||
return normalized
|
||||
}
|
||||
|
||||
export function downloadContainerPdaPhoto(downloadPath: string) {
|
||||
if (!/^\/api\/platform\/v1\/containers\/[1-9][0-9]*\/pda\/photos\/[1-9][0-9]*\/download$/.test(downloadPath)) throw new Error('invalid container photo path')
|
||||
return http.get<Blob, Blob>(downloadPath, { responseType: 'blob' })
|
||||
return http.get<Blob, Blob>(normalizeContainerPhotoDownloadPath(downloadPath), { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export async function createContainerSimulation(payload: ContainerSimulationCreateRequest) {
|
||||
|
||||
Reference in New Issue
Block a user