Merged r2664, r2665, r2670, r2674, r2677, r2679 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2681 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
babbe88a86
commit
7b699af837
@ -65,14 +65,20 @@ class Attachment < ActiveRecord::Base
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Copy temp file to its final location
|
# Copies the temporary file to its final location
|
||||||
|
# and computes its MD5 hash
|
||||||
def before_save
|
def before_save
|
||||||
if @temp_file && (@temp_file.size > 0)
|
if @temp_file && (@temp_file.size > 0)
|
||||||
logger.debug("saving '#{self.diskfile}'")
|
logger.debug("saving '#{self.diskfile}'")
|
||||||
|
md5 = Digest::MD5.new
|
||||||
File.open(diskfile, "wb") do |f|
|
File.open(diskfile, "wb") do |f|
|
||||||
f.write(@temp_file.read)
|
buffer = ""
|
||||||
|
while (buffer = @temp_file.read(8192))
|
||||||
|
f.write(buffer)
|
||||||
|
md5.update(buffer)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self.digest = self.class.digest(diskfile)
|
self.digest = md5.hexdigest
|
||||||
end
|
end
|
||||||
# Don't save the content type if it's longer than the authorized length
|
# Don't save the content type if it's longer than the authorized length
|
||||||
if self.content_type && self.content_type.length > 255
|
if self.content_type && self.content_type.length > 255
|
||||||
@ -141,11 +147,4 @@ private
|
|||||||
end
|
end
|
||||||
df
|
df
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns the MD5 digest of the file at given path
|
|
||||||
def self.digest(filename)
|
|
||||||
File.open(filename, 'rb') do |f|
|
|
||||||
Digest::MD5.hexdigest(f.read)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<h2><%=l(:label_settings)%></h2>
|
<h2><%=l(:label_settings)%></h2>
|
||||||
|
|
||||||
<% tabs = project_settings_tabs %>
|
<% tabs = project_settings_tabs %>
|
||||||
|
|
||||||
|
<% if tabs.any? %>
|
||||||
<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
|
<% selected_tab = params[:tab] ? params[:tab].to_s : tabs.first[:name] %>
|
||||||
|
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
@ -20,5 +22,8 @@
|
|||||||
:style => (tab[:name] != selected_tab ? 'display:none' : nil),
|
:style => (tab[:name] != selected_tab ? 'display:none' : nil),
|
||||||
:class => 'tab-content') %>
|
:class => 'tab-content') %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% else %>
|
||||||
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% html_title(l(:label_settings)) -%>
|
<% html_title(l(:label_settings)) -%>
|
||||||
|
@ -5,6 +5,15 @@ Copyright (C) 2006-2009 Jean-Philippe Lang
|
|||||||
http://www.redmine.org/
|
http://www.redmine.org/
|
||||||
|
|
||||||
|
|
||||||
|
== 2009-xx-xx v0.8.4
|
||||||
|
|
||||||
|
* Allow textile mailto links
|
||||||
|
* Fixed: memory consumption when uploading file
|
||||||
|
* Fixed: Mercurial integration doesn't work if Redmine is installed in folder path containing space
|
||||||
|
* Fixed: an error is raised when no tab is available on project settings
|
||||||
|
* Fixed: insert image macro corrupts urls with excalamation marks
|
||||||
|
|
||||||
|
|
||||||
== 2009-04-05 v0.8.3
|
== 2009-04-05 v0.8.3
|
||||||
|
|
||||||
* Separate project field and subject in cross-project issue view
|
* Separate project field and subject in cross-project issue view
|
||||||
|
@ -792,7 +792,7 @@ class RedCloth3 < String
|
|||||||
(?:\(([^)]+?)\)(?="))? # $title
|
(?:\(([^)]+?)\)(?="))? # $title
|
||||||
":
|
":
|
||||||
( # $url
|
( # $url
|
||||||
(\/|[a-zA-Z]+:\/\/|www\.) # $proto
|
(\/|[a-zA-Z]+:\/\/|www\.|mailto:) # $proto
|
||||||
[\w\/]\S+?
|
[\w\/]\S+?
|
||||||
)
|
)
|
||||||
(\/)? # $slash
|
(\/)? # $slash
|
||||||
@ -907,7 +907,7 @@ class RedCloth3 < String
|
|||||||
end
|
end
|
||||||
|
|
||||||
IMAGE_RE = /
|
IMAGE_RE = /
|
||||||
(<p>|.|^) # start of line?
|
(<p>|\s|^) # start of line?
|
||||||
\! # opening
|
\! # opening
|
||||||
(\<|\=|\>)? # optional alignment atts
|
(\<|\=|\>)? # optional alignment atts
|
||||||
(#{C}) # optional style,class atts
|
(#{C}) # optional style,class atts
|
||||||
|
@ -105,7 +105,7 @@ module Redmine
|
|||||||
# makes Mercurial produce a xml output.
|
# makes Mercurial produce a xml output.
|
||||||
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
||||||
revisions = Revisions.new
|
revisions = Revisions.new
|
||||||
cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{self.class.template_path}"
|
cmd = "#{HG_BIN} --debug --encoding utf8 -R #{target('')} log -C --style #{shell_quote self.class.template_path}"
|
||||||
if identifier_from && identifier_to
|
if identifier_from && identifier_to
|
||||||
cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
|
cmd << " -r #{identifier_from.to_i}:#{identifier_to.to_i}"
|
||||||
elsif identifier_from
|
elsif identifier_from
|
||||||
|
@ -22,6 +22,19 @@ class AttachmentTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def setup
|
def setup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_create
|
||||||
|
a = Attachment.new(:container => Issue.find(1),
|
||||||
|
:file => test_uploaded_file("testfile.txt", "text/plain"),
|
||||||
|
:author => User.find(1))
|
||||||
|
assert a.save
|
||||||
|
assert_equal 'testfile.txt', a.filename
|
||||||
|
assert_equal 59, a.filesize
|
||||||
|
assert_equal 'text/plain', a.content_type
|
||||||
|
assert_equal 0, a.downloads
|
||||||
|
assert_equal Digest::MD5.hexdigest(test_uploaded_file("testfile.txt", "text/plain").read), a.digest
|
||||||
|
assert File.exist?(a.diskfile)
|
||||||
|
end
|
||||||
|
|
||||||
def test_diskfilename
|
def test_diskfilename
|
||||||
assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
|
assert Attachment.disk_filename("test_file.txt") =~ /^\d{12}_test_file.txt$/
|
||||||
@ -30,8 +43,4 @@ class AttachmentTest < Test::Unit::TestCase
|
|||||||
assert_equal 'f8139524ebb8f32e51976982cd20a85d', Attachment.disk_filename("test_accentué")[13..-1]
|
assert_equal 'f8139524ebb8f32e51976982cd20a85d', Attachment.disk_filename("test_accentué")[13..-1]
|
||||||
assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentué.ça")[13..-1]
|
assert_equal 'cbb5b0f30978ba03731d61f9f6d10011', Attachment.disk_filename("test_accentué.ça")[13..-1]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_digest
|
|
||||||
assert_equal '1478adae0d4eb06d35897518540e25d6', Attachment.digest(Test::Unit::TestCase.fixture_path + "/files/testfile.txt")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -55,6 +55,8 @@ class ApplicationHelperTest < HelperTestCase
|
|||||||
'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
|
'ftp://foo.bar' => '<a class="external" href="ftp://foo.bar">ftp://foo.bar</a>',
|
||||||
'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
|
'ftps://foo.bar' => '<a class="external" href="ftps://foo.bar">ftps://foo.bar</a>',
|
||||||
'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
|
'sftp://foo.bar' => '<a class="external" href="sftp://foo.bar">sftp://foo.bar</a>',
|
||||||
|
# two exclamation marks
|
||||||
|
'http://example.net/path!602815048C7B5C20!302.html' => '<a class="external" href="http://example.net/path!602815048C7B5C20!302.html">http://example.net/path!602815048C7B5C20!302.html</a>',
|
||||||
}
|
}
|
||||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
||||||
end
|
end
|
||||||
@ -105,7 +107,11 @@ class ApplicationHelperTest < HelperTestCase
|
|||||||
'"link (Link title with "double-quotes")":http://foo.bar' => '<a href="http://foo.bar" title="Link title with "double-quotes"" class="external">link</a>',
|
'"link (Link title with "double-quotes")":http://foo.bar' => '<a href="http://foo.bar" title="Link title with "double-quotes"" class="external">link</a>',
|
||||||
"This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":</p>\n\n\n\t<p>Another paragraph",
|
"This is not a \"Link\":\n\nAnother paragraph" => "This is not a \"Link\":</p>\n\n\n\t<p>Another paragraph",
|
||||||
# no multiline link text
|
# no multiline link text
|
||||||
"This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test"
|
"This is a double quote \"on the first line\nand another on a second line\":test" => "This is a double quote \"on the first line<br />\nand another on a second line\":test",
|
||||||
|
# mailto link
|
||||||
|
"\"system administrator\":mailto:sysadmin@example.com?subject=redmine%20permissions" => "<a href=\"mailto:sysadmin@example.com?subject=redmine%20permissions\">system administrator</a>",
|
||||||
|
# two exclamation marks
|
||||||
|
'"a link":http://example.net/path!602815048C7B5C20!302.html' => '<a href="http://example.net/path!602815048C7B5C20!302.html" class="external">a link</a>',
|
||||||
}
|
}
|
||||||
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user