Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11316

Content-Type not set for multi-part file

Details

    Description

      When uploading a file as a muti-part file on windows 10 the "Content-Type" header for the file is not set.

      This results in a request that has no content-type that reflects the type of the file.

      This can be resolved by setting a multi-part header after creating the
      BackgroundTransferContentPart

      Link to GitHub file

      by changing the following code:

      var fileToUploadPart = new Windows.Networking.BackgroundTransfer.BackgroundTransferContentPart(fileKey, fileName);
      fileToUploadPart.setFile(storageFile);
      transferParts.push(fileToUploadPart);
      

      To:

      var fileToUploadPart = new Windows.Networking.BackgroundTransfer.BackgroundTransferContentPart(fileKey, fileName);
      
      // added the file mime type
      fileToUploadPart.setHeader("Content-Type", mimeType);
      
      fileToUploadPart.setFile(storageFile);
      transferParts.push(fileToUploadPart);
      

      Attachments

        Issue Links

          Activity

            Could you please submit a pull request for this issue?

            nikhilkh Nikhil Khandelwal added a comment - Could you please submit a pull request for this issue?
            githubbot ASF GitHub Bot added a comment -

            GitHub user ben3005 opened a pull request:

            https://github.com/apache/cordova-plugin-file-transfer/pull/149

            CB-11316 windows: Added content-type for files

            <!--
            Please make sure the checklist boxes are all checked before submitting the PR. The checklist
            is intended as a quick reference, for complete details please see our Contributor Guidelines:

            http://cordova.apache.org/contribute/contribute_guidelines.html

            Thanks!
            -->

                1. Platforms affected
                  Windows
                1. What does this PR do?
                  Adds Content-Type header for files in the multi-part upload
                1. What testing has been done on this change?
                  ran `npm test`

            Tested plugin before with this result:
            ![aapche-before](https://cloud.githubusercontent.com/assets/2751508/16005224/061072c8-315e-11e6-9c7b-3a26c4e7129f.png)

            Tested forked change with the following result:
            ![aapche-after](https://cloud.githubusercontent.com/assets/2751508/16005241/18bfc39c-315e-11e6-9e4b-8fedecdc5443.png)

                1. Checklist
            • added Content-Type header for each file in the multipart upload

            You can merge this pull request into a Git repository by running:

            $ git pull https://github.com/ben3005/cordova-plugin-file-transfer master

            Alternatively you can review and apply these changes as the patch at:

            https://github.com/apache/cordova-plugin-file-transfer/pull/149.patch

            To close this pull request, make a commit to your master/trunk branch
            with (at least) the following in the commit message:

            This closes #149


            commit b639542b57f66df1d78f589f7608ee6f2039872b
            Author: Ben Marshall <ben3005@users.noreply.github.com>
            Date: 2016-06-07T12:56:57Z

            CB-11316 windows: Added content-type for files

            • added Content-Type header for each file in the multipart upload

            githubbot ASF GitHub Bot added a comment - GitHub user ben3005 opened a pull request: https://github.com/apache/cordova-plugin-file-transfer/pull/149 CB-11316 windows: Added content-type for files <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> Platforms affected Windows What does this PR do? Adds Content-Type header for files in the multi-part upload What testing has been done on this change? ran `npm test` Tested plugin before with this result: ! [aapche-before] ( https://cloud.githubusercontent.com/assets/2751508/16005224/061072c8-315e-11e6-9c7b-3a26c4e7129f.png ) Tested forked change with the following result: ! [aapche-after] ( https://cloud.githubusercontent.com/assets/2751508/16005241/18bfc39c-315e-11e6-9e4b-8fedecdc5443.png ) Checklist [x] [ICLA] ( http://www.apache.org/licenses/icla.txt ) has been signed and submitted to secretary@apache.org. [x] [Reported an issue] ( http://cordova.apache.org/contribute/issues.html ) in the JIRA database [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. [ ] Added automated test coverage as appropriate for this change. added Content-Type header for each file in the multipart upload You can merge this pull request into a Git repository by running: $ git pull https://github.com/ben3005/cordova-plugin-file-transfer master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-file-transfer/pull/149.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #149 commit b639542b57f66df1d78f589f7608ee6f2039872b Author: Ben Marshall <ben3005@users.noreply.github.com> Date: 2016-06-07T12:56:57Z CB-11316 windows: Added content-type for files added Content-Type header for each file in the multipart upload
            githubbot ASF GitHub Bot added a comment -

            Github user cordova-qa commented on the issue:

            https://github.com/apache/cordova-plugin-file-transfer/pull/149

            Cordova CI Build has one or more failures.

            *Commit* - [Link](https://github.com/apache/cordova-plugin-file-transfer/pull/149/commits/master)
            *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29/)

            Builder Name Console Output Test Report Device Logs
            :---: :---: :---: :---:
            [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/artifact/)
            [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/artifact/)
            [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/artifact/)
            [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/artifact/)
            [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/artifact/)
            githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/149 Cordova CI Build has one or more failures. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-file-transfer/pull/149/commits/master ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 8.1 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-store/artifact/ ) [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-10-store/artifact/ ) [Windows 8.1 Phone] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=windows-8.1-phone/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=ios/artifact/ ) [Android] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/29//PLATFORM=android/artifact/ )
            ben3005 Ben Marshall added a comment -

            Is there anything else i need to do so this pull request can be merged.

            Cheers,
            Ben

            ben3005 Ben Marshall added a comment - Is there anything else i need to do so this pull request can be merged. Cheers, Ben

            Commit 9dc41bd4e97eafe80fb9bc6573396fcab5967708 in cordova-plugin-file-transfer's branch refs/heads/master from ben3005
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file-transfer.git;h=9dc41bd ]

            CB-11316 windows: Added content-type for files

            • added Content-Type header for each file in the multipart upload

            This closes #149

            jira-bot ASF subversion and git services added a comment - Commit 9dc41bd4e97eafe80fb9bc6573396fcab5967708 in cordova-plugin-file-transfer's branch refs/heads/master from ben3005 [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-file-transfer.git;h=9dc41bd ] CB-11316 windows: Added content-type for files added Content-Type header for each file in the multipart upload This closes #149
            githubbot ASF GitHub Bot added a comment -

            Github user vladimir-kotikov commented on the issue:

            https://github.com/apache/cordova-plugin-file-transfer/pull/149

            Hey. I'm sorry that it took us so long to accept your PR. Merging it now.

            githubbot ASF GitHub Bot added a comment - Github user vladimir-kotikov commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/149 Hey. I'm sorry that it took us so long to accept your PR. Merging it now.
            githubbot ASF GitHub Bot added a comment -

            Github user asfgit closed the pull request at:

            https://github.com/apache/cordova-plugin-file-transfer/pull/149

            githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-file-transfer/pull/149

            People

              Unassigned Unassigned
              ben3005 Ben Marshall
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: