mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-23 16:12:34 +02:00
Merge pull request
This commit is contained in:
@@ -1,28 +1,24 @@
|
||||
import { useLocal } from '../../Utils.js';
|
||||
import getPresignedUrl, { presignedlocalUrl } from './getSignedUrl.js';
|
||||
|
||||
const resolveUrl = async rawUrl => {
|
||||
const isLocal = useLocal == 'true';
|
||||
const shouldUsePresigned = useLocal !== 'true';
|
||||
if (!rawUrl) return rawUrl;
|
||||
if (shouldUsePresigned) {
|
||||
return await getPresignedUrl(rawUrl);
|
||||
} else if (isLocal) {
|
||||
return presignedlocalUrl(rawUrl);
|
||||
}
|
||||
};
|
||||
|
||||
async function UserAfterFind(request) {
|
||||
if (useLocal !== 'true') {
|
||||
if (request.objects.length === 1) {
|
||||
if (request.objects) {
|
||||
const obj = request.objects[0];
|
||||
const ProfilePic = obj?.get('ProfilePic') && obj?.get('ProfilePic');
|
||||
if (ProfilePic) {
|
||||
obj.set('ProfilePic', getPresignedUrl(ProfilePic));
|
||||
}
|
||||
return [obj];
|
||||
}
|
||||
}
|
||||
} else if (useLocal == 'true') {
|
||||
if (request.objects.length === 1) {
|
||||
if (request.objects) {
|
||||
const obj = request.objects[0];
|
||||
const ProfilePic = obj?.get('ProfilePic') && obj?.get('ProfilePic');
|
||||
if (ProfilePic) {
|
||||
obj.set('ProfilePic', presignedlocalUrl(ProfilePic));
|
||||
}
|
||||
return [obj];
|
||||
}
|
||||
if (request.objects.length === 1) {
|
||||
if (request.objects) {
|
||||
const obj = request.objects[0];
|
||||
const ProfilePic = obj?.get('ProfilePic') && obj?.get('ProfilePic');
|
||||
if (ProfilePic) obj.set('ProfilePic', await resolveUrl(ProfilePic));
|
||||
return [obj];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user