diff --git a/webtools/doctor/Doctor/File.pm b/webtools/doctor/Doctor/File.pm index 6e5118306dd..7a8603ac91e 100644 --- a/webtools/doctor/Doctor/File.pm +++ b/webtools/doctor/Doctor/File.pm @@ -368,7 +368,8 @@ sub diff { my $linebreak = $self->linebreak; $revision =~ s/\r\n|\r|\n/$linebreak/g; - return Text::Diff::diff \$self->content, \$revision; + return Text::Diff::diff(\$self->content, \$revision, + {FILENAME_A => $self->spec, FILENAME_B => $self->spec}); } 1; # so the require or use succeeds diff --git a/webtools/doctor/doctor.cgi b/webtools/doctor/doctor.cgi index d3dee713c5b..a624660cb40 100755 --- a/webtools/doctor/doctor.cgi +++ b/webtools/doctor/doctor.cgi @@ -72,7 +72,8 @@ elsif ($action eq "download" || $action eq "display") # Generates and returns a diff of changes between the submitted version # of a page and the version in CVS. Called by the Show Diff panel of the # Edit page. -elsif ($action eq "diff") { diff() } +elsif ($action eq "diff" || $action eq "download-diff") + { diff() } # Returns the content that was submitted to it. Useful for displaying # the modified version of a page the user downloaded and edited locally, @@ -135,7 +136,15 @@ sub diff { my $diff = $file->diff(GetContent()) || "There are no differences between the version in CVS and your revision."; - print $request->header(-type=>"text/plain"); + if ($action eq "diff") { + print $request->header(-type=>"text/plain"); + } + else { + print $request->header( + -type => "text/html; name=\"" . $file->name . ".diff\"", + -content_disposition => "attachment; filename=\"" . $file->name . ".diff\"", + -content_length => length($file->content) ); + } print $diff; } diff --git a/webtools/doctor/templates/edit.tmpl b/webtools/doctor/templates/edit.tmpl index c7eec184ff6..eccf3f850cd 100644 --- a/webtools/doctor/templates/edit.tmpl +++ b/webtools/doctor/templates/edit.tmpl @@ -74,7 +74,7 @@ - +
+ + or commit changes to the repository: +