cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lucas Gonze (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-7566) FileTransfer: Doc incorrectly says that mimeType defaults to "image/jpeg"
Date Wed, 26 Nov 2014 19:19:12 GMT

    [ https://issues.apache.org/jira/browse/CB-7566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14226676#comment-14226676
] 

Lucas Gonze commented on CB-7566:
---------------------------------

TL;DR: Some platforms use image/jgeg as the default, others don't have a default, one gets
the default from the OS.

amazon/FileTransfer.java:
```
        final String mimeType = getArgument(args, 4, "image/jpeg");
```

android/FileTransfer.java:
````
        final String mimeType = getArgument(args, 4, "image/jpeg");
````

ubuntu/file-transfer.cpp:

There is no default value. If left blank by the caller, "Content-type: " is sent but blank.

windows/FileTransferProxy.js:
 // storageFile is a Windows.Storage.StorageFile
 if(!mimeType) {
 // use the actual content type of the file, probably this should be the default way.
  // other platforms probably can't look this up.
  mimeType = storageFile.contentType;
            }
````
wp/FileTransfer.cs:
````
            public TransferOptions()
            {
                FileKey = "file";
                FileName = "image.jpg";
                MimeType = "image/jpeg";
            }
````



> FileTransfer: Doc incorrectly says that mimeType defaults to "image/jpeg"
> -------------------------------------------------------------------------
>
>                 Key: CB-7566
>                 URL: https://issues.apache.org/jira/browse/CB-7566
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin File Transfer
>            Reporter: Jonathan Aquino
>            Priority: Trivial
>
> The documentation for mimeType at https://github.com/apache/cordova-plugin-file-transfer/blob/master/doc/index.md
says 
> "mimeType: The mime type of the data to upload. Defaults to image/jpeg."
> However, if you look at the code in https://github.com/apache/cordova-plugin-file-transfer/blob/master/src/ios/CDVFileTransfer.m
you will see that mimeType is actually not sent if it is unset:
>     if (mimeType != nil) {
>         [postBodyBeforeFile appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n",
mimeType] dataUsingEncoding:NSUTF8StringEncoding]];
>     }
> I recommend changing the doc from "Defaults to image/jpeg." to "If unspecified, no Content-Type
will be sent."



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message