Bug 20259 - Shorter JS and CSS rewrite rule
Summary: Shorter JS and CSS rewrite rule
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on: 20187
Blocks:
  Show dependency treegraph
 
Reported: 2018-02-21 10:06 UTC by Fridolin Somers
Modified: 2019-10-14 19:57 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20259: Shorter JS and CSS rewrite rule (3.60 KB, patch)
2018-02-21 10:29 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 20259: Shorter JS and CSS rewrite rule (3.66 KB, patch)
2018-06-15 21:26 UTC, Charles Farmer
Details | Diff | Splinter Review
Bug 20259: Shorter JS and CSS rewrite rule (3.75 KB, patch)
2018-06-18 18:48 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2018-02-21 10:06:04 UTC
Bug 20187 has changed the JS and CSS rewrite rules to :
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].js$ $1.js [L]
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].css$ $1.css [L]

This can be written more short with one rule and [0-9]{N}.
And the dot in extension needs to be escaped : \.js \.css
Comment 1 Fridolin Somers 2018-02-21 10:29:39 UTC
Created attachment 72014 [details] [review]
Bug 20259: Shorter JS and CSS rewrite rule

Bug 20187 has changed the JS and CSS rewrite rules to :
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].js$ $1.js [L]
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].css$ $1.css [L]

This patch changes this rules using [0-9]{N} and fusion in one rule.
And espaces the dot in extension js and css.

Test plan :
1) Go to intranet and opac
2) Check CSS and JS are doing well
3) Apply patch changes on our Apache configuration
4) Reload intranet and opac pages (Ctrl + F5)
5) Check CSS and JS are doing well
Comment 2 Jonathan Druart 2018-02-21 13:41:56 UTC
Hum, I tried that and it did not work.
Will try again later.
Comment 3 Victor Grousset/tuxayo 2018-02-22 10:54:21 UTC
It works for me. (Apache was restarted, double checked that)

Also tried the test plan from https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20187#c8

And checked the login pages.

Tested with Apache 2.4.18 on Ubuntu 16.04
Comment 4 Charles Farmer 2018-06-15 21:10:16 UTC
Only seeing 200's on my station. Looks good.

Tested with:
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2018-04-18T14:53:04
Comment 5 Charles Farmer 2018-06-15 21:26:43 UTC
Created attachment 76111 [details] [review]
Bug 20259: Shorter JS and CSS rewrite rule

Bug 20187 has changed the JS and CSS rewrite rules to :
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].js$ $1.js [L]
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].css$ $1.css [L]

This patch changes this rules using [0-9]{N} and fusion in one rule.
And espaces the dot in extension js and css.

Test plan :
1) Go to intranet and opac
2) Check CSS and JS are doing well
3) Apply patch changes on our Apache configuration
4) Reload intranet and opac pages (Ctrl + F5)
5) Check CSS and JS are doing well

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>
Comment 6 Jonathan Druart 2018-06-18 18:48:32 UTC
Created attachment 76147 [details] [review]
Bug 20259: Shorter JS and CSS rewrite rule

Bug 20187 has changed the JS and CSS rewrite rules to :
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].js$ $1.js [L]
RewriteRule ^(.*)_[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][0-9].css$ $1.css [L]

This patch changes this rules using [0-9]{N} and fusion in one rule.
And espaces the dot in extension js and css.

Test plan :
1) Go to intranet and opac
2) Check CSS and JS are doing well
3) Apply patch changes on our Apache configuration
4) Reload intranet and opac pages (Ctrl + F5)
5) Check CSS and JS are doing well

Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Nick Clemens 2018-06-22 13:50:57 UTC
Awesome work all!

Pushed to master for 18.11.x
Comment 8 Victor Grousset/tuxayo 2018-06-22 13:53:32 UTC
If I understand correctly: The good thing is that people can keep the old rule without issue so they won't have to change the RewriteRules for 18.05 and 18.11
Comment 9 Jonathan Druart 2018-06-22 14:05:15 UTC
(In reply to Victor Grousset/tuxayo from comment #8)
> If I understand correctly: The good thing is that people can keep the old
> rule without issue so they won't have to change the RewriteRules for 18.05
> and 18.11

Yes, they are similar but one is easier to read.
Comment 10 Martin Renvoize 2018-06-25 17:42:21 UTC
I'm not going to backport this to 18.05.x, save surprising users having to intervene during package upgrades, especially as the rule change is a cosmetic one for server administrators only.
Comment 11 Fridolin Somers 2018-07-18 13:39:44 UTC
(In reply to Martin Renvoize from comment #10)
> I'm not going to backport this to 18.05.x, save surprising users having to
> intervene during package upgrades, especially as the rule change is a
> cosmetic one for server administrators only.

Indeed, server administrators love makeup ;)