The option to "Fix File Locations" returns an error if a file directory doesn't exist yet for a content type
Description
When you click "Fix File Locations" from the area "Admin/Developer Utilities" an error is returned if a file folder is defined in a content type but no content exists for that file folder yet (hence, the folder wasn't automatically created yet).
I had this happen because I have custom types with optional file fields (being optional, some of them weren't used yet).
Possible Solutions:
Do a simple conditional statement to see if the directory exists.
If not, create it. (suggested)
(OR) if not, update the DB and move on
Assuming the DB is being updated, could records now be damaged (due to the error I saw)? I wish we could wrap all those cfloops in a cftransaction tag so that on-error it can abort the DB commit (assuming there are possible cftransaction tags in the method calls (getters/setters)). However, I don't believe nested cftransactions were supported until CF8 or CF9 (and the current minimum support in FarCry 5 is CF7).
When you click "Fix File Locations" from the area "Admin/Developer Utilities" an error is returned if a file folder is defined in a content type but no content exists for that file folder yet (hence, the folder wasn't automatically created yet).
I had this happen because I have custom types with optional file fields (being optional, some of them weren't used yet).
Possible Solutions:
Do a simple conditional statement to see if the directory exists.
If not, create it. (suggested)
(OR) if not, update the DB and move on
Assuming the DB is being updated, could records now be damaged (due to the error I saw)? I wish we could wrap all those cfloops in a cftransaction tag so that on-error it can abort the DB commit (assuming there are possible cftransaction tags in the method calls (getters/setters)). However, I don't believe nested cftransactions were supported until CF8 or CF9 (and the current minimum support in FarCry 5 is CF7).