Create Missing Transcode Folders

This commit is contained in:
Samuel Lorch 2024-06-23 04:13:18 +02:00
parent 36fe3202e8
commit 68093dc543

View file

@ -94,6 +94,13 @@ func handleUpload(w http.ResponseWriter, r *http.Request) {
// MaxBytesReader closes the underlying io.Reader on its Close() is called
defer src.Close()
err = os.MkdirAll(filepath.Base(path), 0775)
if err != nil {
slog.ErrorContext(r.Context(), "Creating Folder", "err", err)
http.Error(w, "Creating Folder: "+err.Error(), http.StatusInternalServerError)
return
}
out, err := os.Create(path)
if err != nil {
slog.ErrorContext(r.Context(), "Creating File", "err", err)