Bugzilla – Attachment 112096 Details for
Bug 26751
Fatal exception if only one repo defined
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26751: Fix fatal exception if only one repo defined
Bug-26751-Fix-fatal-exception-if-only-one-repo-def.patch (text/plain), 2.04 KB, created by
Martin Renvoize (ashimema)
on 2020-10-21 12:35:40 UTC
(
hide
)
Description:
Bug 26751: Fix fatal exception if only one repo defined
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-21 12:35:40 UTC
Size:
2.04 KB
patch
obsolete
>From 756d20672a7e9ccf804a68ecace66abc394a5e7b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 20 Oct 2020 14:40:50 -0300 >Subject: [PATCH] Bug 26751: Fix fatal exception if only one repo defined > >This patch fixes this nasty problem with how XML is parsed: if more than >one entry is found, repo => [] is generated. If only one, repo => {}. > >To test: >1. Have more than one entries in the plugins_repo entry: > ><plugin_repos> > <repo> > <name>ByWater Solutions</name> > <org_name>bywatersolutions</org_name> > <service>github</service> > </repo> > <repo> > <name>Theke Solutions</name> > <org_name>thekesolutions</org_name> > <service>github</service> > </repo> > <repo> > <name>PTFS Europe</name> > <org_name>ptfs-europe</org_name> > <service>github</service> > </repo> > </plugin_repos> > >2. Search for plugins >=> SUCCESS: Searching works! >3. Leave only one entry >4. Restart all to refresh things >5. Try searching for plugins >=> FAIL: Fatal error >6. Apply this patch >7. Repeat 5 >=> SUCCESS: It doesn't explode anymore! >8. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > plugins/plugins-home.pl | 6 ++++++ > 1 file changed, 6 insertions(+) > >diff --git a/plugins/plugins-home.pl b/plugins/plugins-home.pl >index 1efcc02ded..47d5262b32 100755 >--- a/plugins/plugins-home.pl >+++ b/plugins/plugins-home.pl >@@ -63,6 +63,12 @@ if ($plugins_enabled) { > my @results; > if ($plugin_search) { > my $repos = C4::Context->config('plugin_repos'); >+ >+ # Fix data structure if only one repo defined >+ if ( ref($repos->{repo}) eq 'HASH' ) { >+ $repos = { repo => [ $repos->{repo} ] }; >+ } >+ > foreach my $r ( @{ $repos->{repo} } ) { > if ( $r->{service} eq 'github' ) { > my $url = "https://api.github.com/search/repositories?q=$plugin_search+user:$r->{org_name}+in:name,description"; >-- >2.20.1
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 26751
:
112065
|
112070
| 112096