When I try to upload or update an .xml metadata file, the following error is generated

Same for me; wathever the content of the file, the response from server is always:
UnicodeError at /layers/upload
undefined encoding
...
@dpadron @fpennica can you please share a demo of your dataset? Also please make sure to use latest versions there just has happend a Pull request for layer encoding: https://github.com/GeoNode/geonode/pull/5271
I switched to the 2.10.x branch, here are some tests:
UnicodeError, here is an example: http://www.pcn.minambiente.it/geoportal/rest/document?id=m_amte%3A299FN3%3A4c90991f-285c-4964-a633-bacc63bb281f
geonode:test_md_upload_unicodeerror.xml I only commented out the <gmd:fileIdentifier> section, and it gives UnicodeError.Test files:
@fpennica Here is what I tried.
view-source:http://www.pcn.minambiente.it/geoportal/rest/document?id=m_amte%3A299FN3%3A4c90991f-285c-4964-a633-bacc63bb281f (make sure to use the raw output to not get messed up with browser styling output)<gco:CharacterString>3cfa5d20-0b9f-11ea-92e0-0242ac120007</gco:CharacterString> . This is needed otherwise you will get a new one!
https://master.demo.geonode.org/layers/geonode:test_md_upload
As summary, be sure to use a valid xml structure. If you like to update an existing set use the id of the resource. you should get that easily by just downloading the metadata as iso.
hope this helps!
set the correct id of the uploaded layer
<gco:CharacterString>3cfa5d20-0b9f-11ea-92e0-0242ac120007</gco:CharacterString>. This is needed otherwise you will get a new one!
Aaah, I see that now... :) thank you!
Just some observation:
Internal Server Error in case something goes wrong with metadata is not very helpful... maybe an "Incorrect metadata structure" or something like thatUnicodeError wrong when the problem is the xml structure and not the encoding?Thanks!
@fpennica I agree good points! @dpadron would you kindly test this as well and if it works close here?
@fpennica Acepto buenos puntos! @dpadron , 驴podr铆a probar esto tambi茅n amablemente y si funciona cerca aqu铆?
Hi, I performed tests and the problem was that I was trying to update a metadata.xml with the wrong identifier.
聽聽聽聽聽
gmd: fileIdentifier>
I have followed the steps indicated by t-book and it works correctly.
Thank you
Most helpful comment
@fpennica Here is what I tried.
view-source:http://www.pcn.minambiente.it/geoportal/rest/document?id=m_amte%3A299FN3%3A4c90991f-285c-4964-a633-bacc63bb281f(make sure to use the raw output to not get messed up with browser styling output)<gco:CharacterString>3cfa5d20-0b9f-11ea-92e0-0242ac120007</gco:CharacterString>. This is needed otherwise you will get a new one!https://master.demo.geonode.org/layers/geonode:test_md_upload
As summary, be sure to use a valid xml structure. If you like to update an existing set use the id of the resource. you should get that easily by just downloading the metadata as iso.
hope this helps!