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

WebDAV PUT XML content BOM remove error #73

Closed
chirkovmail opened this issue Aug 21, 2012 · 13 comments
Closed

WebDAV PUT XML content BOM remove error #73

chirkovmail opened this issue Aug 21, 2012 · 13 comments

Comments

@chirkovmail
Copy link
Contributor

If XML content import to OpenCms 8.0.4 using WebDAV servlet, 409 error is appear.

The reason is BOM is not removed from XML taken from input stream.

Such error is related with changes in org.opencms.file.wrapper.CmsObjectWrapper#needUtf8Marker method - additional marker check was added:

        if (typeMatch && res.isFile()) {
            CmsFile file = m_cms.readFile(res);
            if ((file.getContents().length >= 3)
                && (file.getContents()[0] == CmsResourceWrapperUtils.UTF8_MARKER[0])
                && (file.getContents()[1] == CmsResourceWrapperUtils.UTF8_MARKER[1])
                && (file.getContents()[2] == CmsResourceWrapperUtils.UTF8_MARKER[2])) {
                typeMatch = false;
            }
        }

So removing of BOM in org.opencms.file.wrapper.CmsObjectWrapper#writeFile in the previous OpenCms version is not performed now:

    // remove the added UTF-8 marker
    if (needUtf8Marker(resource)) {
        resource.setContents(CmsResourceWrapperUtils.removeUtf8Marker(resource.getContents()));
    }

Method writeFile returns false for XML content which already contains BOM.

Temporal solution for current OpenCms version is substitute org.opencms.file.wrapper.CmsObjectWrapper.class file in the opencms.jar.

But such bug should be fixed in next OpenCms version.

@ghost
Copy link

ghost commented Oct 11, 2012

Several hours wasted trying to sync out project vía webdav to OpenCms8.5 with those "409 Conflict" errors. Finally I've found this issue...
Since webdav is the only integrated feature to sync content to real file system I can't understand why Alcakon do not priorize this kind of bugs. This is the only way to work on OCMS in a developer team with source control.

Please would you write additional details about your temporal solution in order to fix it? Thanks!

@chirkovmail
Copy link
Contributor Author

To fix such bug you can substitute class org.opencms.file.wrapper.CmsObjectWrapper.class in opencms.jar of OpenCms 8.0.4 to corresponding class from previous version, OpenCms 7.5.3, for example.

And, of course, you can fix the error in OpenCms sources and rebuild opencms.jar, if it's more convenient for your.

@ghost
Copy link

ghost commented Oct 11, 2012

Thanks for your quick reply chirkovmail. I'll try in 2 hours and tell if it works... I'm working on OpenCms 8.5 but it seems its still unresolved.

@ghost
Copy link

ghost commented Oct 11, 2012

I've done what you said, chirkovmail, but doen't work for me :( Still getting "409 conflict" error.
I replaced org.opencms.file.wrapper.CmsObjectWrapper.class in the 8.5 in opencms.jar with the 7.5.3 one.

What Im trying to do is an export via webdav to OCMS of all files in sites/default. Those files was previously imported via webdav from OpenCms to a RFS folder, so they should be 100% compatible. But fails when it tries to export the properties files. I'm trying to test this in order to get a fresh OpenCms install with all the contents from a previous development.
Same results doing the same test with OpenCms 7.5.4.

@chirkovmail
Copy link
Contributor Author

It was checked for OpenCms 8.0.4 and works for sure. So if it doesn't work for OpenCms 8.5, perhaps there is another reason. You can try to check it if compile OpenCms with corresponding fix.

@ghost
Copy link

ghost commented Oct 11, 2012

I think I have a different kind of problem.
With OpenCms 7.5.3 fresh install:

  • I create an index.htm page, then export it via webdav to disk ( it creates index.html.xml, __properties/index.html.xml.properties)
  • Delete index.html from OpenCms.
  • Try to import previously exported files via webdav and...
    Error 409 conflict.
    Tried with 3 different webdav clients.

@chirkovmail
Copy link
Contributor Author

Please try to publish removed file before import.

@ghost
Copy link

ghost commented Oct 15, 2012

Yes I know, I do publish after delete. That's not the problem. Thanks

@chirkovmail
Copy link
Contributor Author

We also found in some of projects such error (no for all XML content, but for specific resources only), but still not check exact reason. It's not dependent on XML resources type, perhaps file content.
We going to check such points additionally.

@ghost
Copy link

ghost commented Oct 15, 2012

Ok.
I desist from using WEBDAV for sync by now, since we need to synchronize both content and properties.
Thanks for you time.

@tHerrmann
Copy link

This fix will be released in version 8.5.1 within the next few days.

@QuintusFixlein
Copy link

I followed this thread since I had this problem with an earlier version of opencms and an oXygen webdav connection - I could open the filestructure and files, change and save them, but after reopening, everything was gone. Yesterday, I upgraded to v 8.5.1, but unfortunately to no avail.
Can this be caused by the fact that I did'nt do a full new installation but used the upgrade wizard? So that the file in question is still there?
Any help is appreciated!

@tHerrmann
Copy link

Hi,
not all webdav clients will work with OpenCms. One that worked quite well so far is the webdav plugin for eclipse.

We also consider webdav as a legacy feature. It's not very likely that we will do any enhancements or additional features for webdav.

In version 8.5 we added support for CMIS to OpenCms, we think that's the best way to interface with a cms.

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

3 participants