1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:36:15 -07:00

godoc: don't display tar instructions for malformed download query

Ensure that the filename passed via ?download= matches the given
regexp before showing the command-line instructions to download it.

Change-Id: Ieb7c6912409474f31637ff1193fd195eb9f172b3
Reviewed-on: https://go-review.googlesource.com/126717
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
Andrew Bonventre 2018-07-30 14:02:51 -04:00 committed by Brad Fitzpatrick
parent 8cc4e8a6f4
commit 0700b576e4
2 changed files with 3 additions and 3 deletions

View File

@ -253,13 +253,13 @@ function personalizeInstallInstructions() {
var filename = s.substr(prefix.length); var filename = s.substr(prefix.length);
var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/; var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/;
$('.downloadFilename').text(filename);
$('.hideFromDownload').hide();
var m = filenameRE.exec(filename); var m = filenameRE.exec(filename);
if (!m) { if (!m) {
// Can't interpret file name; bail. // Can't interpret file name; bail.
return; return;
} }
$('.downloadFilename').text(filename);
$('.hideFromDownload').hide();
var os = m[3]; var os = m[3];
var ext = m[6]; var ext = m[6];

File diff suppressed because one or more lines are too long