aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-10-08 16:04:48 +0800
committerXi Ruoyao <xry111@xry111.site>2023-10-08 16:04:48 +0800
commitc39bfe9b33f371f9623b5eaa5e030ec2ebedad11 (patch)
treea73e67d33a16a600355053009e3be1e546769fe2
parentd42ea8f08def207bae0c4941df98a9ff4b285b16 (diff)
currency: Do not run strip_tags on api.github.com output
The output of api.github.com is JSON, thus we should not remove every <...> for it. For example, strip_tags had trimmed the JSON for shadow-4.14.1, leading to "Attempt to read property "tag_name" on null".
-rw-r--r--lfs-latest-git.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lfs-latest-git.php b/lfs-latest-git.php
index c0c7aaea3..6894b4a9e 100644
--- a/lfs-latest-git.php
+++ b/lfs-latest-git.php
@@ -85,8 +85,9 @@ function http_get_file( $url )
exec( "curl --location --silent --max-time 30 $url", $dir );
- $s = implode( "\n", $dir );
- $dir = strip_tags( $s );
+ $dir = implode( "\n", $dir );
+ if ( !preg_match( "/api.github.com/", $url) )
+ $dir = strip_tags( $dir );
return explode( "\n", $dir );
}