Skip to content

Commit

Permalink
fix: options parser should add trailing slash to 'media' if not prese…
Browse files Browse the repository at this point in the history
…nt. (google#6263) (google#6264)

* fix: add trailing slash to media option

* fix: add deprecation warning to path option
  • Loading branch information
derwehr authored Jul 12, 2022
1 parent 5612e13 commit bf1a40c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
goog.module('Blockly.Options');

const deprecation = goog.require('Blockly.utils.deprecation');
const idGenerator = goog.require('Blockly.utils.idGenerator');
const registry = goog.require('Blockly.registry');
const toolbox = goog.require('Blockly.utils.toolbox');
Expand Down Expand Up @@ -105,9 +106,11 @@ class Options {
}
let pathToMedia = 'https://blockly-demo.appspot.com/static/media/';
if (options['media']) {
pathToMedia = options['media'];
pathToMedia = options['media'].endsWith('/') ? options['media'] :
options['media'] + '/';
} else if (options['path']) {
// 'path' is a deprecated option which has been replaced by 'media'.
deprecation.warn('path', 'Nov 2014', 'Jul 2023', 'media');
pathToMedia = options['path'] + 'media/';
}
let oneBasedIndex;
Expand Down

0 comments on commit bf1a40c

Please sign in to comment.