[Webkit-unassigned] [Bug 31395] Bugzilla should show images in git patches

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 2 11:44:37 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31395


David Kilzer (ddkilzer) <ddkilzer at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #43038|review?                     |review-
               Flag|                            |




--- Comment #11 from David Kilzer (ddkilzer) <ddkilzer at webkit.org>  2009-12-02 11:44:36 PST ---
(From update of attachment 43038)
Rather than writing a new decode-git-binary-patch script which uses
VCSUtils::decodeGitBinaryPatch(), I think the PrettyPatch.rb script should
instead use a git command to do its decoding work directly.  We can guarantee
that git will be installed on bugs.webkit.org, so we don't have to rely on a
Perl implementation of the git decoding algorithm to get the image data.

> diff --git a/BugsSite/PrettyPatch/PrettyPatch.rb b/BugsSite/PrettyPatch/PrettyPatch.rb
>              lines_with_contents = lines[startOfSections...lines.length]
>              @sections = DiffSection.parse(lines_with_contents) unless @binary
> -            @image_url = "data:image/png;base64," + lines_with_contents.join if @image
> +            if @image
> +                @image_url = "data:image/png;base64," + lines_with_contents.join
> +            elsif @git_image
> +                begin
> +                    stdin, stdout, stderr = *Open3.popen3(GIT_DECODE_PATCH_PATH)
> +                    stdin.puts(lines)
> +                    stdin.close
> +                    @image_urls = stdout.readlines
> +                    stdout.close
> +                    error = stderr.read
> +                    stderr.close
> +                    if error != ''
> +                        @image_error = "Failed to decode git binary patch<pre>#{CGI.escapeHTML(error)}</pre>"
> +                    end
> +                rescue
> +                    @image_error = "Exception raised during decoding git binary patch: #{$!}"

The error message, $!, needs to be HTML-escaped as well.

r- to fix the HTML-escaping issue noted and to use a git command directly to
decode the binary patch.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list