Skip to content

Commit 47a6c0c

Browse files
andybonsbradfitz
authored andcommitted
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 <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]>
1 parent 4bcdbb2 commit 47a6c0c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

static/godocs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ function personalizeInstallInstructions() {
253253

254254
var filename = s.substr(prefix.length);
255255
var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9]+)?(-osx10\.[68])?\.([a-z.]+)$/;
256-
$('.downloadFilename').text(filename);
257-
$('.hideFromDownload').hide();
258256
var m = filenameRE.exec(filename);
259257
if (!m) {
260258
// Can't interpret file name; bail.
261259
return;
262260
}
261+
$('.downloadFilename').text(filename);
262+
$('.hideFromDownload').hide();
263263

264264
var os = m[3];
265265
var ext = m[6];

0 commit comments

Comments
 (0)