-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 10.10
-
Fix Version/s: 10.10-HF22, 11.1, 2021.0
-
Component/s: Web UI
There might be an issue with the UI implementation also sending the wrong dc:title (that is used to generate the file name) in a race situation that could explain why we end up with the duplicate paths on the server:
Check the logic in nuxeo-document-import element ( and the attached screenshots)
- when we upload multiple files, they are stored in the variable : "this.localFiles"
- when we click through the files, the selected file properties (including the dc:title) are stored in the "localFile" array in the method storeFile: function(index)
_storeFile: function(index) { if (this._isValidFileIndex(index)) { var pos = index; var propName = 'localFiles'; if (pos >= this.localFiles.length) { propName = 'remoteFiles'; pos = pos - this.localFiles.length; } this.set([propName, pos, 'docData'].join('.'), { parent: this.targetPath, document: JSON.parse(JSON.stringify(this.document)), type: this.selectedDocType, }); this.set([propName, pos, 'sanitizedName'].join('.'), this._sanitizeName(this.document.properties['dc:title'])); this.set([propName, pos, 'title'].join('.'), this.document.properties['dc:title']); } },
- => in the code above you can see that the title is being fetched from the this.document.properties['dc:title']), so the this.document object that is supposed to reflect the current document being selected in the upload form
- however, this.document is actually set in an asynchronous call _updateDocument
_updateDocument: function() { if (!this._isValidType(this.selectedDocType) || !this.parent) { this.document = null; // prevent error message from being displayed the first time this.$.docTypeDropdown.invalid = false; return; } this.newDocument(this.selectedDocType.type, this._getDocumentProperties()).then(function(document) { document.parentRef = this.parent.uid; this.document = document; }.bind(this)); },
and
in Nuxeo.DocumentCreationBehavior:
newDocument: function(type, properties) { if (!schemaFetcher) { schemaFetcher = document.createElement('nuxeo-resource'); this._attachDom(schemaFetcher); } schemaFetcher.path = 'path/' + this.targetPath + '/@emptyWithDefault'; schemaFetcher.params = { type: this.selectedDocType.type }; schemaFetcher.headers = { properties: '*', 'X-NXfetch.document': 'properties', 'X-NXtranslate.directoryEntry': 'label' }; return schemaFetcher.get().then(function(doc) { if (properties) { for (var prop in properties) { doc.properties[prop] = properties[prop]; } } return doc; }); },
=> so that means that even if I call newDocument with the right properties, they are bound on the this.document later in an async way when the server has returned from the get call=> we can potentially set the wrong title on the document if the user clicks fast between many documents.
I could recreate this by clicking on the next file and delaying the server side response on newDocument with few seconds for the previous one ( breakpoint in EmptyDocumentAdapter).
- depends on
-
WEBUI-134 Fix introduced by NXP-28495 cache invalidates the "Empty document created" event handler
- Resolved
- is duplicated by
-
NXP-28364 Clean up Web UI multi import property editing
- Resolved
- is related to
-
NXP-28406 Handle duplicates with MongoDB
- Resolved
-
NXP-28642 Fix visual bug while importing more than 1 doc file
- Resolved
- Is referenced in