mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-23 08:02:30 +02:00
Merge pull request
This commit is contained in:
@@ -10,37 +10,28 @@ async function DocumentAfterFind(request) {
|
||||
const certificateUrl = obj.get('CertificateUrl') && obj.get('CertificateUrl');
|
||||
const isPrefillExist = obj?.get('Placeholders')?.some(x => x.Role === 'prefill');
|
||||
const Placeholder = obj?.get('Placeholders') || [];
|
||||
if (useLocal !== 'true') {
|
||||
if (isPrefillExist) {
|
||||
const updatedPlaceHolder = await handleValidImage(Placeholder);
|
||||
obj.set('Placeholders', updatedPlaceHolder);
|
||||
|
||||
const shouldUsePresigned = useLocal !== 'true';
|
||||
const isLocal = useLocal == 'true';
|
||||
|
||||
const resolveUrl = async rawUrl => {
|
||||
if (!rawUrl) return rawUrl;
|
||||
if (shouldUsePresigned) {
|
||||
return await getPresignedUrl(rawUrl);
|
||||
} else if (isLocal) {
|
||||
return presignedlocalUrl(rawUrl);
|
||||
}
|
||||
if (SignedUrl) {
|
||||
obj.set('SignedUrl', getPresignedUrl(SignedUrl));
|
||||
}
|
||||
if (Url) {
|
||||
obj.set('URL', getPresignedUrl(Url));
|
||||
}
|
||||
if (certificateUrl) {
|
||||
obj.set('CertificateUrl', getPresignedUrl(certificateUrl));
|
||||
}
|
||||
return [obj];
|
||||
} else if (useLocal == 'true') {
|
||||
if (isPrefillExist) {
|
||||
const updatedPlaceHolder = await handleValidImage(Placeholder);
|
||||
obj.set('Placeholders', updatedPlaceHolder);
|
||||
}
|
||||
if (SignedUrl) {
|
||||
obj.set('SignedUrl', presignedlocalUrl(SignedUrl));
|
||||
}
|
||||
if (Url) {
|
||||
obj.set('URL', presignedlocalUrl(Url));
|
||||
}
|
||||
if (certificateUrl) {
|
||||
obj.set('CertificateUrl', presignedlocalUrl(certificateUrl));
|
||||
}
|
||||
return [obj];
|
||||
};
|
||||
|
||||
if (isPrefillExist) {
|
||||
const updatedPlaceHolder = await handleValidImage(Placeholder);
|
||||
obj.set('Placeholders', updatedPlaceHolder);
|
||||
}
|
||||
|
||||
if (SignedUrl) obj.set('SignedUrl', await resolveUrl(SignedUrl));
|
||||
if (Url) obj.set('URL', await resolveUrl(Url));
|
||||
if (certificateUrl) obj.set('CertificateUrl', await resolveUrl(certificateUrl));
|
||||
return [obj];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user