Skip to content

Commit 3033717

Browse files
authored
Merge pull request scratchfoundation#4748 from LLK/hotfix/assetIdNull
Hotfix/asset id null
2 parents 7e2f9b8 + 5758626 commit 3033717

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ before_deploy:
2525
if [ -z "$BEFORE_DEPLOY_RAN" ]; then
2626
npm --no-git-tag-version version $RELEASE_VERSION
2727
if [ "$TRAVIS_BRANCH" == "master" ]; then export NPM_TAG=stable; fi
28+
if [[ "$TRAVIS_BRANCH" == hotfix/* ]]; then export NPM_TAG=hotfix; fi # double brackets are important for matching the wildcard
2829
git config --global user.email $(git log --pretty=format:"%ae" -n1)
2930
git config --global user.name $(git log --pretty=format:"%an" -n1)
3031
export BEFORE_DEPLOY_RAN=true
@@ -36,6 +37,7 @@ deploy:
3637
- master
3738
- develop
3839
- smoke
40+
- hotfix/*
3941
condition: $TRAVIS_EVENT_TYPE != cron
4042
skip_cleanup: true
4143
email: $NPM_EMAIL

src/containers/backpack.jsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@ class Backpack extends React.Component {
8383
}
8484
handleDrop (dragInfo) {
8585
let payloader = null;
86+
let presaveAsset = null;
8687
switch (dragInfo.dragType) {
8788
case DragConstants.COSTUME:
8889
payloader = costumePayload;
90+
presaveAsset = dragInfo.payload.asset;
8991
break;
9092
case DragConstants.SOUND:
9193
payloader = soundPayload;
94+
presaveAsset = dragInfo.payload.asset;
9295
break;
9396
case DragConstants.SPRITE:
9497
payloader = spritePayload;
@@ -102,6 +105,19 @@ class Backpack extends React.Component {
102105
// Creating the payload is async, so set loading before starting
103106
this.setState({loading: true}, () => {
104107
payloader(dragInfo.payload, this.props.vm)
108+
.then(payload => {
109+
// Force the asset to save to the asset server before storing in backpack
110+
// Ensures any asset present in the backpack is also on the asset server
111+
if (presaveAsset && !presaveAsset.clean) {
112+
return storage.store(
113+
presaveAsset.assetType,
114+
presaveAsset.dataFormat,
115+
presaveAsset.data,
116+
presaveAsset.assetId
117+
).then(() => payload);
118+
}
119+
return payload;
120+
})
105121
.then(payload => saveBackpackObject({
106122
host: this.props.host,
107123
token: this.props.token,

0 commit comments

Comments
 (0)