AWS Gateway messes with content of uploaded Python source files. #1067

Open
opened 2018-12-14 19:47:08 +00:00 by reckoner · 0 comments
reckoner commented 2018-12-14 19:47:08 +00:00 (Migrated from github.com)

The following code uploads nicely.

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  title = 'app';

  public uploader: FileUploader = new FileUploader({url: URL, itemAlias: 'code',disableMultipart: true});

  ngOnInit() {
    this.uploader.onAfterAddingFile = (file) => { file.withCredentials = false; };
    this.uploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => {
         console.log('ImageUpload:uploaded:', item, status, response);
         alert('File uploaded successfully');
     };
 }
}

But when I point it at an AWS Lambda-backed API Gateway, the body of the response has altered the whitespace in the uploaded file. This is a problem because the files I am using this to upload are Python source code files which are whitespace-sensitive.

How can I get the uploader to tell AWS Gateway to not process the file content? I don't have this problem with a flask backend, just with the AWS Gateway.

The following code uploads nicely. @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { title = 'app'; public uploader: FileUploader = new FileUploader({url: URL, itemAlias: 'code',disableMultipart: true}); ngOnInit() { this.uploader.onAfterAddingFile = (file) => { file.withCredentials = false; }; this.uploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => { console.log('ImageUpload:uploaded:', item, status, response); alert('File uploaded successfully'); }; } } But when I point it at an AWS Lambda-backed API Gateway, the `body` of the response has altered the whitespace in the uploaded file. This is a problem because the files I am using this to upload are Python source code files which are whitespace-sensitive. How can I get the uploader to tell AWS Gateway to not process the file content? I don't have this problem with a flask backend, just with the AWS Gateway.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#1067