Uploaded image for project: 'Nuxeo .NET Client'
  1. Nuxeo .NET Client
  2. NETCLIENT-16

Invalid mime-type set using .NET client

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0-beta-38250
    • Component/s: Uploader

      Description

      Steps to reproduce:

      • Upload a text plain file using the .NET client. See code used:
              /// <summary>
              ///     Upload a file with API and create a document using API.
              /// </summary>
              /// <param name="fileName">Full path file to upload.</param>
              /// <param name="folder">Destination folder.</param>
              /// <remarks>
              ///     This method create the correct document "type" and upload the document,
              ///     but is not possible to see the preview.
              /// </remarks>
              /// <see href="http://doc.nuxeo.com/nxdoc/net-client/" />
              public async Task CreateDocumentWithApi(string fileName, string folder)
              {
                  try
                  {
                      // Upload the file.
                      var uploader = new Uploader(_client);
                      uploader.AddFile(fileName);
                      await uploader.UploadFiles();
      
                      var document = (Document) await _client.Operation("Document.Create")
                          .SetInput(folder)
                          .SetParameter("entity-type", "document")
                          .SetParameter("type", "vmr_document_type")
                          .SetParameter("name", "Cappe03")
                          .SetParameter("properties", new ParamProperties
                          {
                              {"dc:title", "A doc"},
                              {"dc:description", "descrizione"},
                              {"vmr_document_type:cod_fornitore", "test cod_fornitore"},
                              {
                                  "file:content", new JObject(
                                      new JProperty("upload-batch", uploader.Batch.BatchId),
                                      new JProperty("upload-fileId", "0")
                                  )
                              }
                          })
                          .Execute();
                  }
                  catch (Exception e)
                  {
                      Debug.WriteLine(e);
                      throw;
                  }
              }
      
      • The file is created successfully, but the thumbnail is not generated. This error is wrote in the server.log:

      org.nuxeo.ecm.core.convert.api.ConversionException: application/text%2Fplain mime type not supported by anyToThumbnail converter

      See the full log:

      2019-02-21T11:35:33,391 WARN  [Nuxeo-Work-default-6:1351945841105414.390932306] [org.nuxeo.ecm.platform.thumbnail.factories.ThumbnailDocumentFactory] Cannot compute document thumbnail
      org.nuxeo.ecm.core.convert.api.ConversionException: application/text%2Fplain mime type not supported by anyToThumbnail converter
              at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convert(ConversionServiceImpl.java:323) ~[nuxeo-core-convert-10.10.jar:?]
              at org.nuxeo.ecm.platform.thumbnail.factories.ThumbnailDocumentFactory.computeThumbnail(ThumbnailDocumentFactory.java:92) [nuxeo-thumbnail-10.10.jar:?]
              at org.nuxeo.ecm.core.api.thumbnail.ThumbnailServiceImpl.computeThumbnail(ThumbnailServiceImpl.java:99) [nuxeo-core-api-10.10.jar:?]
              at org.nuxeo.ecm.core.api.thumbnail.ThumbnailAdapter.computeThumbnail(ThumbnailAdapter.java:58) [nuxeo-core-api-10.10.jar:?]
              at org.nuxeo.ecm.platform.thumbnail.listener.UpdateThumbnailListener.processDoc(UpdateThumbnailListener.java:67) [nuxeo-thumbnail-10.10.jar:?]
              at org.nuxeo.ecm.platform.thumbnail.listener.UpdateThumbnailListener.handleEvent(UpdateThumbnailListener.java:137) [nuxeo-thumbnail-10.10.jar:?]
              at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$ListenerWork.work(AsyncEventExecutor.java:221) [nuxeo-core-event-10.10.jar:?]
              at org.nuxeo.ecm.core.work.AbstractWork.runWorkWithTransaction(AbstractWork.java:437) [nuxeo-core-event-10.10.jar:?]
              at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:357) [nuxeo-core-event-10.10.jar:?]
              at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:57) [nuxeo-core-event-10.10.jar:?]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191]
              at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191]
       
      

      Other example:

      If you upload a pdf using the .NET client the mime-type is set to: application/application%2Fpdf

      If you upload the same file through the user interface the mime-type is set to: application/pdf

      Please, see the JSON export generated with Nuxeo Dev Tools for the same document, uploaded from the user interface and using the .NET Client

        Attachments

        1. image003.png
          239 kB
          Joaquin Garzon Pena
        2. NuxeoUploader.cs
          7 kB
          Joaquin Garzon Pena
        3. upload_by_API.JSON
          4 kB
          Joaquin Garzon Pena
        4. upload_by_UI.JSON
          6 kB
          Joaquin Garzon Pena

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 6 hours
                  1d 6h