You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While pretty much everything in C1 correctly uses C1Directory and C1File for file operations, which in turns makes it possible to customize where a file and directly lives, ie. Amazon S3 or inside a zip file instead of regular files on disk, there is a section in the XmlDataProvider which fails to do so.
This means that while its possible to load XmlDataStore files from S3, you can't save them back, they always go to local disk on the server C1 is running.
The correct approach is to pass a FileStream to the XmlWriter which points to the temporary file, and afterwards use C1File.Copy, which will allow for the same functionality to happen via a custom IIOProvider instead hardcoded to the physical file system.
The text was updated successfully, but these errors were encountered:
burningice2866
changed the title
XmlDataProvider doesn't use IIOFileProvider when saving xml files
XmlDataProvider doesn't use C1File when saving xml files
Jan 27, 2022
While pretty much everything in C1 correctly uses C1Directory and C1File for file operations, which in turns makes it possible to customize where a file and directly lives, ie. Amazon S3 or inside a zip file instead of regular files on disk, there is a section in the XmlDataProvider which fails to do so.
This means that while its possible to load XmlDataStore files from S3, you can't save them back, they always go to local disk on the server C1 is running.
The code in question is this https://github.com/Orckestra/C1-CMS-Foundation/blob/master/Composite/Plugins/Data/DataProviders/XmlDataProvider/Foundation/XmlDataProviderDocumentWriter.cs#L173-L222 which was introduced at some point to prevent corrupting xml files in case of C1 being shut down while writing.
The correct approach is to pass a FileStream to the XmlWriter which points to the temporary file, and afterwards use C1File.Copy, which will allow for the same functionality to happen via a custom IIOProvider instead hardcoded to the physical file system.
The text was updated successfully, but these errors were encountered: