This commit is contained in:
Raktima
2026-05-22 21:03:28 +05:30
committed by GitHub
parent b9a309fa36
commit 1e228c86c3
92 changed files with 8705 additions and 5397 deletions
@@ -43,7 +43,7 @@ function makeS3Client() {
}
export default async function getPresignedUrl(url) {
if (url?.includes('files')) {
if (url?.includes('/files/')) {
return presignedlocalUrl(url);
} else {
const client = makeS3Client();
@@ -70,7 +70,7 @@ export async function getSignedUrl(request) {
if (docId || templateId) {
try {
if (url?.includes('files')) {
if (url?.includes('/files/')) {
return presignedlocalUrl(url);
} else if (useLocal !== 'true') {
const query = new Parse.Query(docId ? 'contracts_Document' : 'contracts_Template');
@@ -106,7 +106,7 @@ export async function getSignedUrl(request) {
if (!isAuth) {
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'User is not authenticated.');
} else {
if (url?.includes('files')) {
if (url?.includes('/files/')) {
return presignedlocalUrl(url);
} else if (useLocal !== 'true') {
const presignedUrl = await getPresignedUrl(url);
@@ -147,7 +147,7 @@ export function getSignedLocalUrl(fileUrl, expirationTimeInSeconds) {
}
export function presignedlocalUrl(signedUrl, expirationTimeInSeconds) {
if (signedUrl?.includes('files')) {
if (signedUrl?.includes('/files/')) {
const fileUrl = signedUrl.split('?')?.[0];
const secretKey = process.env.MASTER_KEY;
const exp = expirationTimeInSeconds || 200;