mirror of https://github.com/kern/filepizza
checkpoint
parent
ca704ec572
commit
4cb02da415
@ -1,17 +0,0 @@
|
|||||||
import { UploadedFile } from '../types'
|
|
||||||
|
|
||||||
export function validateOffset(
|
|
||||||
files: UploadedFile[],
|
|
||||||
fullPath: string,
|
|
||||||
offset: number,
|
|
||||||
): UploadedFile {
|
|
||||||
const validFile = files.find(
|
|
||||||
(file) =>
|
|
||||||
(file.fullPath === fullPath || file.name === fullPath) &&
|
|
||||||
offset <= file.size,
|
|
||||||
)
|
|
||||||
if (!validFile) {
|
|
||||||
throw new Error('invalid file offset')
|
|
||||||
}
|
|
||||||
return validFile
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue