small improvements
This commit is contained in:
parent
b37d695091
commit
b07040a26f
|
@ -131,7 +131,7 @@ export default function LinkDetails({ link }: Props) {
|
|||
height={42}
|
||||
alt=""
|
||||
id={"favicon-" + link.id}
|
||||
className="select-none mt-2 rounded-full shadow border-[3px] border-white bg-white aspect-square"
|
||||
className="select-none mt-2 rounded-md shadow border-[3px] border-white bg-white aspect-square"
|
||||
draggable="false"
|
||||
onLoad={(e) => {
|
||||
try {
|
||||
|
|
|
@ -4,6 +4,7 @@ import getTitle from "@/lib/api/getTitle";
|
|||
import archive from "@/lib/api/archive";
|
||||
import { Collection, Link, UsersAndCollections } from "@prisma/client";
|
||||
import getPermission from "@/lib/api/getPermission";
|
||||
import createFolder from "@/lib/api/storage/createFolder";
|
||||
|
||||
export default async function postLink(
|
||||
link: LinkIncludingShortenedCollectionAndTags,
|
||||
|
@ -14,7 +15,7 @@ export default async function postLink(
|
|||
if (!link.name) {
|
||||
return { response: "Please enter a valid name for the link.", status: 400 };
|
||||
} else if (!link.collection.name) {
|
||||
return { response: "Please enter a valid collection.", status: 400 };
|
||||
link.collection.name = "Other";
|
||||
}
|
||||
|
||||
if (link.collection.id) {
|
||||
|
@ -83,6 +84,8 @@ export default async function postLink(
|
|||
include: { tags: true, collection: true },
|
||||
});
|
||||
|
||||
createFolder({ filePath: `archives/${newLink.collectionId}` });
|
||||
|
||||
archive(newLink.url, newLink.collectionId, newLink.id);
|
||||
|
||||
return { response: newLink, status: 200 };
|
||||
|
|
|
@ -4,7 +4,7 @@ import s3Client from "./s3Client";
|
|||
|
||||
export default function createFolder({ filePath }: { filePath: string }) {
|
||||
if (s3Client) {
|
||||
// Do nothing, S3 builds files recursively
|
||||
// Do nothing, S3 creates directories recursively
|
||||
} else {
|
||||
const storagePath = process.env.STORAGE_FOLDER;
|
||||
const creationPath = path.join(process.cwd(), storagePath + "/" + filePath);
|
||||
|
|
Ŝarĝante…
Reference in New Issue