Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-19890

Unable to upload file to Raw repo using Powershell

    Details

      Description

      After updating to 3.16.1 it became unable to upload files to Raw repo via Powershell Invoke-WebRequest (curl is ok).

      Strict content type validation is unchecked.

       

      $publishUrl="https://nexus.contoso.com/repository/artifacts/foo/bar.zip"
      $packageName = "bar.zip"
      $username="upload-user"
      $password="upload-user-pass"
      
      $params = @{
        UseBasicParsing = $true
        Uri             = $publishUrl
        Method          = "PUT"
        InFile          = $packageName
        Headers         = @{
          ContentType   = "application/zip"
          Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$username`:$password")))" 
        }
        Verbose         = $true
      }
      Invoke-WebRequest @params
      

      Got error:

      Invoke-WebRequest : Anti cross-site request forgery token mismatch
      

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mpiggott Matthew Piggott
              Reporter:
              psmolkin Pavel Smolkin
              Last Updated By:
              Peter Lynch Peter Lynch
              Team:
              NXRM - Tron
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title