omeka-s-modules / FileSideload

GNU General Public License v3.0
2 stars 3 forks source link

Temp files can get left lying around #34

Open zerocrates opened 1 year ago

zerocrates commented 1 year ago

The Sideload ingesters copy the file to a temp location, then call validate on it, then run mediaIngestFile. If the validation fails, the temp file won't get deleted.

Two possible solutions I see:

  1. Call delete on the tempFile before returning when validation fails
  2. Don't call validate at all: mediaIngestFile already does that

Option 1 would be the more minimal change. Option 2 is cleaner, but I'm not sure if maybe Sideload had some reason to separately validate... my best guess is that it probably was from when sideload used to work directly off the sideload-directory file without copying it to temp, and it did that to avoid deleting the original file if it failed validation. If that's the case it's not necessary to do separately anymore.

This looks like it's the same issue for both the single and "directory" sideloads.