forked from SoDOff-Project/sodoff
better handle proxy cache rename error
This commit is contained in:
parent
b7720af330
commit
2dfb5fd1b8
@ -107,7 +107,13 @@ public class AssetMiddleware
|
|||||||
}
|
}
|
||||||
|
|
||||||
// after successfully write data to temporary file, rename it to proper asset filename
|
// after successfully write data to temporary file, rename it to proper asset filename
|
||||||
File.Move(filePathTmp, filePath);
|
try {
|
||||||
|
File.Move(filePathTmp, filePath);
|
||||||
|
} catch (System.IO.IOException) {
|
||||||
|
// this can happen for example if two clients request the same file in the same time
|
||||||
|
// TODO: avoid redundant download in those cases
|
||||||
|
File.Delete(filePathTmp);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await inputStream.CopyToAsync(context.Response.Body);
|
await inputStream.CopyToAsync(context.Response.Body);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user