Issue 35326 (OverwritingStorageTests) design discussion

I opened issue 35326 - there’s a hook in FileSystemStorage for overwriting OS_OPEN_FLAGS to allow changing the storage to (for example) allow overwriting files instead of getting a new file name if there’s a file name collision. This feature is tested, but fails if an upload written to a temporary file (instead of staying in memory) is used.

See the issue for an example test that fails. How should we update the design so temporary files work also?

In the work where this feature was added, there was a rejected option where an ALLOW_OVERWRITE flag was added to the FileSystemStorage.

Since the feature allowing file overwrite using the OS_OPEN_FLAGS is broken in some cases, what if we deprecate OS_OPEN_FLAGS, add an ALLOW_OVERWRITE boolean, and then we could check that boolean to allow file overwrite where the file is in memory or written to a temporary file?

(Although OS_OPEN_FLAGS doesn’t appear to be documented, so maybe it wouldn’t need to go through a deprecation period?)

I opened a draft PR.

I think the PR is coming along nicely and I like the suggested design :+1:

OS_OPEN_FLAGS doesn’t appear to be documented, so maybe it wouldn’t need to go through a deprecation period?

I think let’s deprecate, although most instances I’ve found of people using OS_OPEN_FLAGS is a direct copy and paste, at least the warning encourages users to remove this and there’s a chance it is in use.