From ea5a3a6d7e765f09cd11b7f385b13257c735b7a8 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 4 May 2025 09:15:50 +0200 Subject: [PATCH] srht-gen-oauth-tok: fix html parsing --- .../sr/srht-gen-oauth-tok/fix-html-parsing.patch | 16 ++++++++++++++++ pkgs/by-name/sr/srht-gen-oauth-tok/package.nix | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 pkgs/by-name/sr/srht-gen-oauth-tok/fix-html-parsing.patch diff --git a/pkgs/by-name/sr/srht-gen-oauth-tok/fix-html-parsing.patch b/pkgs/by-name/sr/srht-gen-oauth-tok/fix-html-parsing.patch new file mode 100644 index 000000000000..f413a68d97dc --- /dev/null +++ b/pkgs/by-name/sr/srht-gen-oauth-tok/fix-html-parsing.patch @@ -0,0 +1,16 @@ +diff --git a/srht-gen-oauth-tok b/srht-gen-oauth-tok +index a05e209..f2949b5 100755 +--- a/srht-gen-oauth-tok ++++ b/srht-gen-oauth-tok +@@ -78,7 +78,10 @@ $mech->submit_form( with_fields => { comment => $tok_comment } ); + + # Parse the response as XML and find the access token via an XPath expression + my $xpc = XML::LibXML::XPathContext->new( +- XML::LibXML->load_xml(string => $mech->content()) ++ XML::LibXML->load_html( ++ string => $mech->content(), ++ recover => 1, ++ ) + ); + # The token is set as the description (
) of a 'Personal Access Token' term (
) + my $token = $xpc->find("//dt[text() = 'Personal Access Token']/following-sibling::dd/*/node()"); diff --git a/pkgs/by-name/sr/srht-gen-oauth-tok/package.nix b/pkgs/by-name/sr/srht-gen-oauth-tok/package.nix index 0c8829a96ba9..547bd4ea229c 100644 --- a/pkgs/by-name/sr/srht-gen-oauth-tok/package.nix +++ b/pkgs/by-name/sr/srht-gen-oauth-tok/package.nix @@ -25,6 +25,8 @@ stdenv.mkDerivation rec { hash = "sha256-GcqP3XbVw2sR5n4+aLUmA4fthNkuVAGnhV1h7suJYdI="; }; + patches = [ ./fix-html-parsing.patch ]; + buildInputs = [ perl ]; nativeBuildInputs = [ perl ];