diff --git a/script/serve-public.js b/script/serve-public.js index c5b2d7e1e5..eea3379624 100755 --- a/script/serve-public.js +++ b/script/serve-public.js @@ -29,8 +29,8 @@ const handler = (request, response) => { let stats = fs.statSync(filename, { throwIfNoEntry: false }); if (!stats?.isFile() && !filename.match(/\.[A-Za-z0-9]{1,11}$/)) { - filename += ".html"; - stats = fs.statSync(filename, { throwIfNoEntry: false }); + filename += ".html"; + stats = fs.statSync(filename, { throwIfNoEntry: false }); } try{ if (!stats?.isFile()) throw new Error(`Not a file: ${filename}`); diff --git a/script/update-book2.rb b/script/update-book2.rb index 36baea4b52..c040387ef8 100644 --- a/script/update-book2.rb +++ b/script/update-book2.rb @@ -196,7 +196,7 @@ def genbook(language_code, &get_content) end images.each do |path| - content = get_content.call(path) + content = get_content.call(path, :gently => true) csection.saveImage(path, content) rescue Errno::ENOENT begin @@ -289,11 +289,11 @@ def remote_genbook2(language_code) # Generate book html directly from local git repo" def local_genbook2(language_code, worktree_path) if language_code && worktree_path - book = genbook(language_code) do |filename| + book = genbook(language_code) do |filename, options={}| File.open(File.join(worktree_path, filename), "r") { |infile| File.read(infile) } - rescue - puts "::error::#{filename} is missing!" - "**ERROR**: _#{filename} is missing_" + rescue => e + puts "::error::#{filename} is missing!" unless options[:gently] + raise e end book.sha = `git -C "#{worktree_path}" rev-parse HEAD`.chomp if language_code == 'en'