Bugzilla – Attachment 194441 Details for
Bug 38365
Add Content-Security-Policy HTTP header to HTML responses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38365: Use Koha::Devel::Files->ls_tt_files in add_csp_nonces.pl
d2fb283.patch (text/plain), 2.02 KB, created by
Jonathan Druart
on 2026-03-04 10:57:53 UTC
(
hide
)
Description:
Bug 38365: Use Koha::Devel::Files->ls_tt_files in add_csp_nonces.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2026-03-04 10:57:53 UTC
Size:
2.02 KB
patch
obsolete
>From d2fb283fc38390be38a2b500232b90b34300c2ee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 Mar 2026 11:23:46 +0100 >Subject: [PATCH] Bug 38365: Use Koha::Devel::Files->ls_tt_files in > add_csp_nonces.pl > >--- > misc/devel/add_csp_nonces.pl | 37 +++++++----------------------------- > 1 file changed, 7 insertions(+), 30 deletions(-) > >diff --git a/misc/devel/add_csp_nonces.pl b/misc/devel/add_csp_nonces.pl >index 5b307638ccf..7ba655ba73e 100755 >--- a/misc/devel/add_csp_nonces.pl >+++ b/misc/devel/add_csp_nonces.pl >@@ -49,10 +49,11 @@ The script: > > use Modern::Perl; > use Carp qw( carp ); >-use File::Find; > use Getopt::Long; > use Pod::Usage; > >+use Koha::Devel::Files; >+ > my $apply = 0; > my $verbose = 0; > my $help = 0; >@@ -70,35 +71,15 @@ pod2usage(1) if $help; > # The nonce attribute to add > my $nonce_attr = 'nonce="[% Koha.CSPNonce | $raw %]"'; > >-# Patterns to skip (library files, etc.) >-my @skip_patterns = ( >- qr{/lib/}, # Third-party libraries >- qr{/vendor/}, # Vendor files >- qr{\.min\.}, # Minified files >- qr{/node_modules/}, # Node modules >-); >- > my %stats = ( > files_scanned => 0, > files_modified => 0, > tags_modified => 0, > ); > >-sub should_skip_file { >- my ($file) = @_; >- for my $pattern (@skip_patterns) { >- return 1 if $file =~ $pattern; >- } >- return 0; >-} >- > sub process_file { > my ($file) = @_; > >- return unless -f $file; >- return unless $file =~ /\.(tt|inc)$/; >- return if should_skip_file($file); >- > $stats{files_scanned}++; > > open my $fh, '<:encoding(UTF-8)', $file or do { >@@ -174,15 +155,11 @@ sub process_file { > } > > # Find and process all template files >-find( >- { >- wanted => sub { >- process_file($File::Find::name); >- }, >- no_chdir => 1, >- }, >- $dir >-); >+my $dev_files = Koha::Devel::Files->new; >+my @tt_files = $dev_files->ls_tt_files; >+for my $file (@tt_files) { >+ process_file($file); >+} > > # Print summary > say ""; >-- >2.43.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38365
:
174054
|
188487
|
188488
|
188489
|
188490
|
188491
|
188733
|
188734
|
188735
|
188736
|
188737
|
188881
|
188882
|
189465
|
189466
|
189467
|
189468
|
189469
|
189470
|
189471
|
189472
|
191618
|
191619
|
191620
|
191621
|
191622
|
191623
|
191660
|
191661
|
191662
|
191663
|
191664
|
191665
|
191666
|
191667
|
191668
|
192294
|
192295
|
192296
|
192297
|
192298
|
192299
|
192300
|
192301
|
192302
|
192303
|
192304
|
192305
|
192306
|
192412
|
192413
|
192414
|
192415
|
192416
|
192417
|
192418
|
192419
|
192420
|
192421
|
192422
|
192423
|
192424
|
192425
|
192426
|
192427
|
192428
|
192429
|
192524
|
192535
|
192536
|
192537
|
192553
|
192554
|
192555
|
192556
|
192557
|
192558
|
192559
|
192560
|
192561
|
192562
|
192563
|
192564
|
192565
|
192566
|
192567
|
192568
|
192569
|
192570
|
192571
|
192572
|
192573
|
192574
|
192684
|
192685
|
192686
|
192691
|
192692
|
192693
|
192694
|
192695
|
192696
|
192697
|
192698
|
192699
|
192700
|
192701
|
192702
|
192703
|
192704
|
192705
|
192706
|
192707
|
192708
|
192709
|
192738
|
192843
|
192844
|
192934
|
192935
|
192936
|
192937
|
193288
|
193289
|
193290
|
193291
|
193292
|
193293
|
193294
|
193295
|
193296
|
193297
|
193298
|
193299
|
193300
|
193301
|
193302
|
193303
|
193304
|
193305
|
193306
|
193307
|
193308
|
193309
|
193310
|
193311
|
193312
|
193335
|
193705
|
193706
|
193707
|
193708
|
193709
|
193710
|
193711
|
193712
|
193713
|
193714
|
193941
|
193942
|
193943
|
193944
|
193945
|
193946
|
193947
|
193948
|
193949
|
193950
|
193951
|
193952
|
193953
|
193954
|
193955
|
193956
|
193957
|
193958
|
193959
|
193960
|
193961
|
193962
|
193963
|
193964
|
193965
|
193966
|
193967
|
193968
|
194374
|
194422
|
194423
|
194424
|
194425
|
194426
|
194427
|
194428
|
194440
| 194441 |
194448
|
194449