Skip to content

Commit

Permalink
Copy and unlink instead of rename
Browse files Browse the repository at this point in the history
  • Loading branch information
cb1kenobi committed Mar 5, 2024
1 parent 586caee commit e4f71f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/api/cla/sign/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CLA_VERISON } from '@/lib/cla-constants';
import { claDir, createPDF, CreatePDFData } from '@/lib/cla';
import { join } from 'node:path';
import { existsSync } from 'node:fs';
import { rename, unlink, writeFile } from 'node:fs/promises';
import { copyFile, unlink, writeFile } from 'node:fs/promises';
import { getServerSession } from 'next-auth/next';
import type { ExtendedProfile } from '@/lib/auth';
import { tmpdir } from 'node:os';
Expand Down Expand Up @@ -57,7 +57,8 @@ export async function POST(req: Request) {
}

const pdfFile = await createPDF(data);
await rename(pdfFile, destPdf);
await copyFile(pdfFile, destPdf);
await unlink(pdfFile);

const claInfo = {
username: data.githubUsername,
Expand Down

0 comments on commit e4f71f6

Please sign in to comment.