Skip to content

Commit

Permalink
Ensure remote params are not saved to non-remote channel versions (ra…
Browse files Browse the repository at this point in the history
  • Loading branch information
carrolp authored May 24, 2023
1 parent 7916e9d commit 714d1e3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/apollo/resolvers/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ const channelResolvers = {
if( contentType === CHANNEL_CONSTANTS.CONTENTTYPES.UPLOADED ) {
// Normalize
newChannelObj.data_location = newChannelObj.data_location ? newChannelObj.data_location.toLowerCase() : conf.storage.defaultLocation;
// Clear out `remote` so that it cannot be stored on a non-remote channel
delete newChannelObj.remote;

// if there is a list of valid data locations, validate the data_location (if provided) is in the list
Expand Down Expand Up @@ -508,6 +509,10 @@ const channelResolvers = {
throw new RazeeValidationError( context.req.t( 'The remote version parameters are too large. The string representation must be less than {{MAX_REMOTE_PARAMETERS_LENGTH}} characters long', { MAX_REMOTE_PARAMETERS_LENGTH } ), context );
}
}
else {
// Clear out `remote` so that it cannot be stored on a non-remote channel
remote = null;
}

logger.info({ req_id, user, org_id, uuid, name }, `${queryName} saving`);

Expand Down Expand Up @@ -749,6 +754,10 @@ const channelResolvers = {
};
}
}
else {
// Clear out `remote` so that it cannot be stored on a non-remote channel
remote = null;
}

if( description ) set.description = description;

Expand Down

0 comments on commit 714d1e3

Please sign in to comment.