Skip to content

Commit

Permalink
Merge pull request #2747 from uselagoon/2746-broken-task-file-upload
Browse files Browse the repository at this point in the history
#2746 fix broken file upload with a workaround:
  • Loading branch information
Schnitzel authored Jul 2, 2021
2 parents 89b888d + bd1854b commit 8252dbe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion services/api/src/resources/file/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { s3Client } from '../../clients/aws';
import { query } from '../../util/db';
import { Sql } from './sql';
import { Sql as taskSql } from '../task/sql';
import fs from "fs";


const generateDownloadLink = file => {
Expand Down Expand Up @@ -59,10 +60,11 @@ export const uploadFilesForTask: ResolverFn = async (

const resolvedFiles = await Promise.all(files);
const uploadAndTrackFiles = resolvedFiles.map(async (newFile: any) => {
const readStream = newFile.createReadStream()
const s3_key = `tasks/${task}/${newFile.filename}`;
const params = {
Key: s3_key,
Body: newFile.stream,
Body: fs.createReadStream(readStream.path),
ACL: 'private'
};
// @ts-ignore
Expand Down

0 comments on commit 8252dbe

Please sign in to comment.