diff options
author | Xi Ruoyao <xry111@xry111.site> | 2023-10-08 16:04:48 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2023-10-08 16:04:48 +0800 |
commit | c39bfe9b33f371f9623b5eaa5e030ec2ebedad11 (patch) | |
tree | a73e67d33a16a600355053009e3be1e546769fe2 | |
parent | d42ea8f08def207bae0c4941df98a9ff4b285b16 (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.php | 5 |
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 ); } |