mirror of
https://github.com/scratchfoundation/scratch-resources.git
synced 2025-05-15 07:41:06 -04:00
fix generated urls
use url.resolve instead of just path. Path takes out the double slash on the `https://`
This commit is contained in:
parent
be8f209b45
commit
0212544da2
3 changed files with 8 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,4 +3,5 @@
|
|||
|
||||
# NPM
|
||||
/node_modules
|
||||
npm-*
|
||||
npm-*
|
||||
localized-urls.json
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var url = require('url');
|
||||
var merge = require('lodash.merge');
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -47,12 +48,12 @@ const allFilesSync = (dir, fileList = []) => {
|
|||
};
|
||||
|
||||
const fileId = (dir, file) => {
|
||||
return dir + '.' + path.parse(file).name + "Link" ;
|
||||
return dir + '.' + path.parse(file).name + 'Link';
|
||||
};
|
||||
|
||||
const bucketPath = (resource, locale, file) => {
|
||||
const bucketRoot = 'https://resources.scratch.mit.edu/www/';
|
||||
return path.join(bucketRoot, resource, locale, file);
|
||||
return url.resolve(bucketRoot, path.join(resource, locale, file));
|
||||
};
|
||||
|
||||
const localeURL = (resource, locale, file) => {
|
||||
|
@ -118,4 +119,4 @@ try {
|
|||
|
||||
var allFiles = allFilesSync(inputsDir);
|
||||
var output = parseFileList(allFiles);
|
||||
writeJsonFile(outputDir, output);
|
||||
writeJsonFile(outputDir, output);
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
// var BUCKET_NAME = 'scratch-resources';
|
||||
var BUCKET_URL = 'https://scratch-resources.s3.amazonaws.com';
|
||||
var BUCKET_WEBSITE_URL = 'https://resources.scratch.mit.edu';
|
||||
var S3B_ROOT_DIR = 'source/';
|
||||
//var S3B_ROOT_DIR = 'source/'; //use this to restrict browsing to the source folder
|
||||
var S3B_ROOT_DIR = '';
|
||||
var S3B_SORT = 'A2Z';
|
||||
// var EXCLUDE_FILE = '.DS_Store';
|
||||
// var AUTO_TITLE = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue