File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ export async function POST(req: Request) {
126
126
return ;
127
127
}
128
128
129
- const mergedPdfBytes = await CreatePDF ( files ) ;
129
+ const mergedPdfBytes = await CreatePDF ( orderedFiles ) ;
130
130
[ public_id_cloudinary , finalUrl ] = await uploadPDFFile (
131
131
mergedPdfBytes ,
132
132
uploadPreset ,
@@ -204,12 +204,13 @@ async function uploadFile(
204
204
}
205
205
}
206
206
207
- async function CreatePDF ( files : File [ ] ) {
207
+ async function CreatePDF ( orderedFiles : File [ ] ) {
208
208
const pdfDoc = await PDFDocument . create ( ) ;
209
209
//sort files using name. Later remove to see if u can without names
210
- const orderedFiles = Array . from ( files ) . sort ( ( a , b ) => {
211
- return a . name . localeCompare ( b . name ) ;
212
- } ) ;
210
+ // moved to main function
211
+ // const orderedFiles = Array.from(files).sort((a, b) => {
212
+ // return a.name.localeCompare(b.name);
213
+ // });
213
214
214
215
for ( const file of orderedFiles ) {
215
216
const fileBlob = new Blob ( [ file ] ) ;
You can’t perform that action at this time.
0 commit comments