Description
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
15.2.0
Bug summary
I have a document type Foo, which includes a property named "file" with the data type FileUploadField.
I created content of type Foo, uploaded a file in the "file" field, and clicked "Save and Publish". The uploaded file was saved in the folder "wwwroot/media/{kind of id}/{file name}". In the published version of the document, the file property contained the value "{kind of id}/{file name}".
Later, I removed the file from the content and clicked "Save". At this point, the saved version no longer contained a value for the file property. However, the published version still retained the previous file reference. Here’s the interesting part: the file was also deleted from the physical file system, meaning it no longer existed at "wwwroot/media/{kind of id}/{file name}". This creates a situation where the Save action affects the published state, even though saved and published states are meant to be independent.
As I understand it, the purpose of having separate saved and published states is to maintain different versions of the same content without affecting each other. One could argue that Umbraco is only responsible for managing property values, not the file system. However, if that's the case, shouldn't it avoid saving files to the physical file system in the first place? It seems Umbraco has partial responsibility—it handles saving but does not manage deletion correctly.
Is this the expected behavior, or is it a bug?
Specifics
No response
Steps to reproduce
- Fresh umbraco install
- Create doc type Foo with a property of FileUploadField
- Create content of Foo data type
- Upload the file and click "Save and Publish"
- Make sure the file has been saved and copy the file link
- Open file link in browser: file existed
- Click "Remove file(s)" button and click "Save"
- One more time open the file by copied link: 404 response
Expected result / actual result
The published version should retain its content regardless of any changes made to the saved version.