Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa4fb5f4ca | ||
|
|
6872c5e0b9 | ||
|
|
e27460a0a7 | ||
|
|
3f6656a495 | ||
|
|
a3f69e248a | ||
|
|
3022d067ba | ||
|
|
e06987ab52 | ||
|
|
ace65df230 | ||
|
|
c5dadfd322 | ||
|
|
7a59f2df12 | ||
|
|
7b699af837 |
@@ -23,7 +23,7 @@ class IssuesController < ApplicationController
|
|||||||
before_filter :find_project, :only => [:new, :update_form, :preview]
|
before_filter :find_project, :only => [:new, :update_form, :preview]
|
||||||
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu]
|
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu]
|
||||||
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
||||||
accept_key_auth :index, :changes
|
accept_key_auth :index, :show, :changes
|
||||||
|
|
||||||
helper :journals
|
helper :journals
|
||||||
helper :projects
|
helper :projects
|
||||||
@@ -343,10 +343,12 @@ class IssuesController < ApplicationController
|
|||||||
@gantt.events = events
|
@gantt.events = events
|
||||||
end
|
end
|
||||||
|
|
||||||
|
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
||||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image')
|
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
|
||||||
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{@project.nil? ? '' : "#{@project.identifier}-" }gantt.pdf") }
|
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,12 @@ module QueriesHelper
|
|||||||
when :subject
|
when :subject
|
||||||
h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') +
|
h((!@project.nil? && @project != issue.project) ? "#{issue.project.name} - " : '') +
|
||||||
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
|
link_to(h(value), :controller => 'issues', :action => 'show', :id => issue)
|
||||||
|
when :project
|
||||||
|
link_to(h(value), :controller => 'projects', :action => 'show', :id => value)
|
||||||
|
when :assigned_to
|
||||||
|
link_to(h(value), :controller => 'account', :action => 'show', :id => value)
|
||||||
|
when :author
|
||||||
|
link_to(h(value), :controller => 'account', :action => 'show', :id => value)
|
||||||
when :done_ratio
|
when :done_ratio
|
||||||
progress_bar(value, :width => '80px')
|
progress_bar(value, :width => '80px')
|
||||||
when :fixed_version
|
when :fixed_version
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ module RepositoriesHelper
|
|||||||
|
|
||||||
def subversion_field_tags(form, repository)
|
def subversion_field_tags(form, repository)
|
||||||
content_tag('p', form.text_field(:url, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)) +
|
content_tag('p', form.text_field(:url, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?)) +
|
||||||
'<br />(http://, https://, svn://, file:///)') +
|
'<br />(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') +
|
||||||
content_tag('p', form.text_field(:login, :size => 30)) +
|
content_tag('p', form.text_field(:login, :size => 30)) +
|
||||||
content_tag('p', form.password_field(:password, :size => 30, :name => 'ignore',
|
content_tag('p', form.password_field(:password, :size => 30, :name => 'ignore',
|
||||||
:value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)),
|
:value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)),
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ require 'redmine/scm/adapters/subversion_adapter'
|
|||||||
class Repository::Subversion < Repository
|
class Repository::Subversion < Repository
|
||||||
attr_protected :root_url
|
attr_protected :root_url
|
||||||
validates_presence_of :url
|
validates_presence_of :url
|
||||||
validates_format_of :url, :with => /^(http|https|svn|svn\+ssh|file):\/\/.+/i
|
validates_format_of :url, :with => /^(http|https|svn(\+[^\s:\/\\]+)?|file):\/\/.+/i
|
||||||
|
|
||||||
def scm_adapter
|
def scm_adapter
|
||||||
Redmine::Scm::Adapters::SubversionAdapter
|
Redmine::Scm::Adapters::SubversionAdapter
|
||||||
|
|||||||
+5
-4
@@ -15,8 +15,11 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
require 'rails_generator/secret_key_generator'
|
||||||
|
|
||||||
class Token < ActiveRecord::Base
|
class Token < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
validates_uniqueness_of :value
|
||||||
|
|
||||||
@@validity_time = 1.day
|
@@validity_time = 1.day
|
||||||
|
|
||||||
@@ -36,9 +39,7 @@ class Token < ActiveRecord::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
def self.generate_token_value
|
def self.generate_token_value
|
||||||
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
s = Rails::SecretKeyGenerator.new(object_id).generate_secret
|
||||||
token_value = ''
|
s[0, 40]
|
||||||
40.times { |i| token_value << chars[rand(chars.size-1)] }
|
|
||||||
token_value
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+8
-2
@@ -175,8 +175,14 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.find_by_autologin_key(key)
|
def self.find_by_autologin_key(key)
|
||||||
token = Token.find_by_action_and_value('autologin', key)
|
tokens = Token.find_all_by_action_and_value('autologin', key)
|
||||||
token && (token.created_on > Setting.autologin.to_i.day.ago) && token.user.active? ? token.user : nil
|
# Make sure there's only 1 token that matches the key
|
||||||
|
if tokens.size == 1
|
||||||
|
token = tokens.first
|
||||||
|
if (token.created_on > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
|
||||||
|
token.user
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Makes find_by_mail case-insensitive
|
# Makes find_by_mail case-insensitive
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class WikiContent < ActiveRecord::Base
|
|||||||
belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
|
belongs_to :page, :class_name => 'WikiPage', :foreign_key => 'page_id'
|
||||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||||
validates_presence_of :text
|
validates_presence_of :text
|
||||||
|
validates_length_of :comments, :maximum => 255, :allow_nil => true
|
||||||
|
|
||||||
acts_as_versioned
|
acts_as_versioned
|
||||||
class Version
|
class Version
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
xml.instruct!
|
xml.instruct!
|
||||||
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
|
||||||
xml.title truncate_single_line(@title, 100)
|
xml.title truncate_single_line(@title, 100)
|
||||||
xml.link "rel" => "self", "href" => url_for(params.merge({:format => nil, :only_path => false}))
|
xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false))
|
||||||
xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false)
|
xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil))
|
||||||
xml.id url_for(:controller => 'welcome', :only_path => false)
|
xml.id url_for(:controller => 'welcome', :only_path => false)
|
||||||
xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
|
xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema)
|
||||||
xml.author { xml.name "#{Setting.app_title}" }
|
xml.author { xml.name "#{Setting.app_title}" }
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<% n = 0 -%>
|
<% n = 0 -%>
|
||||||
<% @issue.custom_values.each do |value| -%>
|
<% @issue.custom_field_values.each do |value| -%>
|
||||||
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
|
<td valign="top"><b><%=h value.custom_field.name %>:</b></td><td valign="top"><%= simple_format(h(show_value(value))) %></td>
|
||||||
<% n = n + 1
|
<% n = n + 1
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
|
|||||||
@@ -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)) -%>
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
<p><%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %></p>
|
<p><%= link_to l(:label_issue_view_all), :controller => 'issues', :action => 'index', :project_id => @project, :set_filter => 1 %></p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= call_hook(:view_projects_show_left, :project => @project) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
@@ -53,6 +54,7 @@
|
|||||||
<p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p>
|
<p><%= link_to l(:label_news_view_all), :controller => 'news', :action => 'index', :project_id => @project %></p>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= call_hook(:view_projects_show_right, :project => @project) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<%= link_to l(:label_news_view_all), :controller => 'news' %>
|
<%= link_to l(:label_news_view_all), :controller => 'news' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= call_hook(:view_welcome_index_left, :projects => @projects) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="splitcontentright">
|
<div class="splitcontentright">
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= call_hook(:view_welcome_index_right, :projects => @projects) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
|||||||
@@ -5,6 +5,22 @@ Copyright (C) 2006-2009 Jean-Philippe Lang
|
|||||||
http://www.redmine.org/
|
http://www.redmine.org/
|
||||||
|
|
||||||
|
|
||||||
|
== 2009-05-17 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
|
||||||
|
* Fixed: error on cross-project gantt PNG export
|
||||||
|
* Fixed: self and alternate links in atom feeds do not respect Atom specs
|
||||||
|
* Fixed: accept any svn tunnel scheme in repository URL
|
||||||
|
* Fixed: issues/show should accept user's rss key
|
||||||
|
* Fixed: consistency of custom fields display on the issue detail view
|
||||||
|
* Fixed: wiki comments length validation is missing
|
||||||
|
* Fixed: weak autologin token generation algorithm causes duplicate tokens
|
||||||
|
|
||||||
|
|
||||||
== 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
|
||||||
|
|||||||
+2
-2
@@ -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
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Redmine
|
|||||||
module VERSION #:nodoc:
|
module VERSION #:nodoc:
|
||||||
MAJOR = 0
|
MAJOR = 0
|
||||||
MINOR = 8
|
MINOR = 8
|
||||||
TINY = 3
|
TINY = 4
|
||||||
|
|
||||||
# Branch values:
|
# Branch values:
|
||||||
# * official release: nil
|
# * official release: nil
|
||||||
|
|||||||
@@ -195,8 +195,13 @@ task :migrate_from_mantis => :environment do
|
|||||||
file_type
|
file_type
|
||||||
end
|
end
|
||||||
|
|
||||||
def read
|
def read(*args)
|
||||||
content
|
if @read_finished
|
||||||
|
nil
|
||||||
|
else
|
||||||
|
@read_finished = true
|
||||||
|
content
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -135,8 +135,15 @@ namespace :redmine do
|
|||||||
File.file? trac_fullpath
|
File.file? trac_fullpath
|
||||||
end
|
end
|
||||||
|
|
||||||
def read
|
def open
|
||||||
File.open("#{trac_fullpath}", 'rb').read
|
File.open("#{trac_fullpath}", 'rb') {|f|
|
||||||
|
@file = f
|
||||||
|
yield self
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def read(*args)
|
||||||
|
@file.read(*args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def description
|
def description
|
||||||
@@ -506,12 +513,14 @@ namespace :redmine do
|
|||||||
# Attachments
|
# Attachments
|
||||||
ticket.attachments.each do |attachment|
|
ticket.attachments.each do |attachment|
|
||||||
next unless attachment.exist?
|
next unless attachment.exist?
|
||||||
a = Attachment.new :created_on => attachment.time
|
attachment.open {
|
||||||
a.file = attachment
|
a = Attachment.new :created_on => attachment.time
|
||||||
a.author = find_or_create_user(attachment.author)
|
a.file = attachment
|
||||||
a.container = i
|
a.author = find_or_create_user(attachment.author)
|
||||||
a.description = attachment.description
|
a.container = i
|
||||||
migrated_ticket_attachments += 1 if a.save
|
a.description = attachment.description
|
||||||
|
migrated_ticket_attachments += 1 if a.save
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Custom fields
|
# Custom fields
|
||||||
@@ -556,12 +565,14 @@ namespace :redmine do
|
|||||||
page.attachments.each do |attachment|
|
page.attachments.each do |attachment|
|
||||||
next unless attachment.exist?
|
next unless attachment.exist?
|
||||||
next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page
|
next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page
|
||||||
a = Attachment.new :created_on => attachment.time
|
attachment.open {
|
||||||
a.file = attachment
|
a = Attachment.new :created_on => attachment.time
|
||||||
a.author = find_or_create_user(attachment.author)
|
a.file = attachment
|
||||||
a.description = attachment.description
|
a.author = find_or_create_user(attachment.author)
|
||||||
a.container = p
|
a.description = attachment.description
|
||||||
migrated_wiki_attachments += 1 if a.save
|
a.container = p
|
||||||
|
migrated_wiki_attachments += 1 if a.save
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,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$/
|
||||||
assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
|
assert_equal 'test_file.txt', Attachment.disk_filename("test_file.txt")[13..-1]
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user