bug fix
This commit is contained in:
@@ -97,7 +97,7 @@ export default async function postLink(
|
||||
|
||||
createFolder({ filePath: `archives/${newLink.collectionId}` });
|
||||
|
||||
archive(newLink.url, newLink.collectionId, newLink.id);
|
||||
archive(newLink.id, newLink.url);
|
||||
|
||||
return { response: newLink, status: 200 };
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { prisma } from "@/lib/api/db";
|
||||
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||
import { Collection, Link, UsersAndCollections } from "@prisma/client";
|
||||
import getPermission from "@/lib/api/getPermission";
|
||||
import moveFile from "@/lib/api/storage/moveFile";
|
||||
|
||||
export default async function updateLink(
|
||||
link: LinkIncludingShortenedCollectionAndTags,
|
||||
@@ -98,6 +99,18 @@ export default async function updateLink(
|
||||
},
|
||||
});
|
||||
|
||||
if (targetLink.collection.id !== link.collection.id) {
|
||||
await moveFile(
|
||||
`archives/${targetLink.collection.id}/${link.id}.pdf`,
|
||||
`archives/${link.collection.id}/${link.id}.pdf`
|
||||
);
|
||||
|
||||
await moveFile(
|
||||
`archives/${targetLink.collection.id}/${link.id}.png`,
|
||||
`archives/${link.collection.id}/${link.id}.png`
|
||||
);
|
||||
}
|
||||
|
||||
return { response: updatedLink, status: 200 };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user