Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlDataProvider doesn't use C1File when saving xml files #793

Open
burningice2866 opened this issue Jan 27, 2022 · 0 comments
Open

XmlDataProvider doesn't use C1File when saving xml files #793

burningice2866 opened this issue Jan 27, 2022 · 0 comments

Comments

@burningice2866
Copy link
Contributor

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.

@burningice2866 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant