fix(file): skip redundant MinIO round-trips for files already in target bucket
deploy-chabokan / deploy (push) Canceled after 0s

moveFromTempToMain was calling statObject/copy/remove against MinIO for
every file already attached to a property on every save, even when the
file was already in the target bucket and never touched temp. This added
a blocking network round-trip per image/document on every property save.
Now files already pointing at the target bucket are returned immediately
without hitting MinIO.
This commit is contained in:
2026-08-19 08:02:10 +03:30
parent e63ac1ddf4
commit 9b88b342ad
+6
View File
@@ -185,6 +185,12 @@ const moveFromTempToMain = async (files, targetBucket) => {
return null
}
// Already pointing at the target bucket (e.g. re-submitted unchanged on every
// property save) - skip the MinIO round-trips entirely, nothing to move.
if (rawStr.includes(`/${targetBucket}/`) && !rawStr.includes(`/${tempBucket}/`)) {
return rawStr.split('?')[0]
}
try {
// Check if object exists in temp bucket
const existsInTemp = await minioClient.statObject(tempBucket, fileName).then(() => true).catch(() => false)