Skip to content

Commit b83824d

Browse files
authored
Merge pull request #1501 from processing/bug/duplicate-sketch-media-files
[#1500] Update sketch media file duplication code
2 parents 4b3e005 + cc6d868 commit b83824d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

client/modules/IDE/actions/project.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
import { clearState, saveState } from '../../../persistState';
1717

1818
const ROOT_URL = getConfig('API_URL');
19+
const S3_BUCKET_URL_BASE = getConfig('S3_BUCKET_URL_BASE');
20+
const S3_BUCKET = getConfig('S3_BUCKET');
1921

2022
export function setProject(project) {
2123
return {
@@ -287,7 +289,7 @@ export function cloneProject(id) {
287289

288290
// duplicate all files hosted on S3
289291
each(newFiles, (file, callback) => {
290-
if (file.url && file.url.includes('amazonaws')) {
292+
if (file.url && (file.url.includes(S3_BUCKET_URL_BASE) || file.url.includes(S3_BUCKET))) {
291293
const formParams = {
292294
url: file.url
293295
};

server/controllers/aws.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function getExtension(filename) {
2828
export function getObjectKey(url) {
2929
const urlArray = url.split('/');
3030
let objectKey;
31-
if (urlArray.length === 6) {
31+
if (urlArray.length === 5) {
3232
const key = urlArray.pop();
3333
const userId = urlArray.pop();
3434
objectKey = `${userId}/${key}`;

0 commit comments

Comments
 (0)