Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28495

Fix possible bug in Document Import with slow server responses


    • 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
    • Release Notes Summary:
      Document Import handles slow server responses.
    • Tags:
    • Backlog priority:
    • Sprint:
      nxGang Sprint 11.1.25, UI - 2020-10
    • Story Points:


      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.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;
              this.newDocument(this.selectedDocType.type, this._getDocumentProperties()).then(function(document) {
                document.parentRef = this.parent.uid;
                this.document = document;


      in Nuxeo.DocumentCreationBehavior:

           newDocument: function(type, properties) {
              if (!schemaFetcher) {
                schemaFetcher = document.createElement('nuxeo-resource');
              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).


          Issue Links



              • Votes:
                0 Vote for this issue
                7 Start watching this issue


                • Created:

                  Time Tracking

                  Original Estimate - Not Specified
                  Not Specified
                  Remaining Estimate - 0 minutes
                  Time Spent - 1 day, 1 hour, 15 minutes
                  1d 1h 15m


                    Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.