git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUGFIX PATCH 1/4] git-instaweb: Fix issue with static files for 'plackup' server

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 30, 2010, 00:40 UTC
Message-ID
<201012300140.07843.jnareb@gmail.com>
In-Reply-To
<7v1v50rvat.fsf@alter.siamese.dyndns.org>
On Thu, 30 Dec 2010, Junio C Hamano wrote:
Show 18 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > The default (in gitweb/Makefile) is to use relative paths for gitweb
> > static files, e.g. "static/gitweb.css" for GITWEB_CSS.  But the
> > configuration for Plack::Middleware::Static in plackup_conf assumed
> > that static files must be absolute paths starting with "/gitweb/"
> > prefix which had to be stripped, e.g. "/gitweb/static/gitweb.css".
> > This in turn caused web server run by "git instaweb --httpd=plackup"
> > to not access static files (e.g. CSS) correctly.
> >
> > This is a minimal fixup, making 'plackup' web server in git-instaweb
> > work with default gitweb build configuration.
> >
> > Reported-by: Tadeusz Sośnierz <tadzikes@gmail.com>
> > Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> > ---
> > The regexp is probably too strict: qr{^/static/} should be enough,
> > but I didn't want to change too much at once.
[...]
Show 14 quoted lines
> > diff --git a/git-instaweb.sh b/git-instaweb.sh
> > index 10fcebb..bb57d81 100755
> > --- a/git-instaweb.sh
> > +++ b/git-instaweb.sh
> > @@ -549,7 +549,7 @@ my \$app = builder {
> >  	};
> >  	# serve static files, i.e. stylesheet, images, script
> >  	enable 'Static',
> > -		path => sub { m!\.(js|css|png)\$! && s!^/gitweb/!! },
> > +		path => qr{^/static/.*(?:js|css|png)\$},
> 
> I wonder if you meant qr{^/static/.*\\.(?:js|css|png)\$} here, to make
> sure that these three tokens are file suffixes, not just random
> substring.

Yes, it should be qr{^/static/.*\\.(?:js|css|png)\$} though as I said: "The regexp is probably too strict: qr{^/static/} should be enough,"

-- 
Jakub Narebski
Poland
Previous: Junio C HamanoNext: Jakub Narebski
Message 5 of 9 in “git-instaweb: Three fixes and one improvement”
  1. 0/4 git-instaweb: Three fixes and one improvementJakub Narebski, Dec 29, 2010
  2. 1/4 git-instaweb: Fix issue with static files for 'plackup' serverJakub Narebski, Dec 29, 2010
  3. Junio C HamanoDec 29, 2010
  4. Junio C HamanoDec 29, 2010
  5. Jakub NarebskiDec 30, 2010
  6. 2/4 git-instaweb: Static files are under "static/" in gitweb_confJakub Narebski, Dec 29, 2010
  7. 3/4 git-instaweb: Add checks that web server can be started and is startedJakub Narebski, Dec 29, 2010
  8. 4/4 git-instaweb: Use "git-instaweb" as sitename (for page titles)Jakub Narebski, Dec 29, 2010
  9. Eric WongDec 30, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.