According to the docs, this code should create a new file (nameconflict=“makeunique” ), but doesn’t happen.
<cffile action="write"
file="#ExpandPath('./fileExists.txt')#"
output="fileExists.txt"
nameconflict="makeunique">
OS : Windows 10
Lucee Version : 5.3.4.80
I don’t think nameconflict
applies to action="write"
. The Lucee docs don’t specify which actions it applies to, but the Adobe docs are clear that it doesn’t.
FileWrite()
doesn’t have that option either.
it’s not handled, i wouldn’t mind it as a new feature
cacheHandler = pageContext.getConfig().getCacheHandlerCollection(Config.CACHE_TYPE_FILE, null).getInstanceMatchingObject(cachedWithin, null);
if (cacheHandler instanceof CacheHandlerPro) {
CacheItem cacheItem = ((CacheHandlerPro) cacheHandler).get(pageContext, cacheId, cachedWithin);
if (cacheItem instanceof FileCacheItem) {
pageContext.setVariable(variable, ((FileCacheItem) cacheItem).getData());
return;
}
}
else if (cacheHandler != null) { // TODO this else block can be removed when all cache handlers implement CacheHandlerPro
CacheItem cacheItem = cacheHandler.get(pageContext, cacheId);
if (cacheItem instanceof FileCacheItem) {
pageContext.setVariable(variable, ((FileCacheItem) cacheItem).getData());
return;
}
}
}
and while looking at that code, I tweaked the error messages a bit
lucee:5.3
← zspitzer:patch-7
opened 04:49PM - 29 Apr 20 UTC
Yes, it’is true.
But ACF ignore completely the nameconflict attribute with write action.
Simple, overwrite the file…
In Lucee
nameconflict=“error” → works
nameconflict=“skip” → works
nameconflict=“overwrite” → works
nameconflict=“unique” → NOT works
Valid values are [error,makeunique (unique),overwrite (merge),skip (ignore)]
thanks Zac!
( … Love uppercase of first letter )
("missing attribute action");
("Missing attribute action");
cheers(sic)
File a bug, it should either work or error