From bf1a40c36bad8ada4a69d5ef304a68ed3da2694a Mon Sep 17 00:00:00 2001 From: Thomas Wehr Date: Tue, 12 Jul 2022 22:40:16 +0200 Subject: [PATCH] fix: options parser should add trailing slash to 'media' if not present. (#6263) (#6264) * fix: add trailing slash to media option * fix: add deprecation warning to path option --- core/options.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/options.js b/core/options.js index af6994377dd..06886ff6b1d 100644 --- a/core/options.js +++ b/core/options.js @@ -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'); @@ -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;