public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
encode search/tag urls properly [rob-twf]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@3058 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Fri Nov 23 21:07:19 -0800 2007
commit  632f7735b6eaa878a9d5e418c0791f16e96fd06f
tree    6abf832d940b4499f19935a04ac55e107e0523f1
parent  13f2e77001bf8b0bed560b4a114e5952d74c3d4e
...
1
2
 
 
 
 
 
 
3
4
5
...
1
2
3
4
5
6
7
8
9
10
11
0
@@ -1,5 +1,11 @@
0
 * SVN *
0
 
0
+* encode search/tag urls properly [rob-twf]
0
+
0
+* update article forms to explain new tag syntax (comma and space delimited tags) [xavier, rick]
0
+
0
+* start converting tests to rspec
0
+
0
 * tweak mephisto_init to support the new ActionController::Dispatcher class. [Rob Anderton]
0
 
0
 * Don't generate an article event for unversioned changes. [Marcus Brito]
...
 
 
1
2
3
...
170
171
172
173
 
174
175
176
177
 
178
179
180
...
1
2
3
4
5
...
172
173
174
 
175
176
177
178
 
179
180
181
182
0
@@ -1,3 +1,5 @@
0
+require 'uri'
0
+
0
 class Site < ActiveRecord::Base
0
   @@default_assigns = {}
0
   @@theme_path = Pathname.new(RAILS_ROOT) + 'themes'
0
@@ -170,11 +172,11 @@ class Site < ActiveRecord::Base
0
   end
0
 
0
   def search_url(query, page = nil)
0
- "/#{search_path}?q=#{CGI::escapeHTML(query)}#{%(&page=#{CGI::escapeHTML(page.to_s)}) unless page.blank?}"
0
+ "/#{search_path}?q=#{CGI::escapeHTML(query)}#{%(&amp;page=#{CGI::escapeHTML(page.to_s)}) unless page.blank?}"
0
   end
0
 
0
   def tag_url(*tags)
0
- ['', tag_path, *tags] * '/'
0
+ ['', tag_path, *tags.collect { |t| URI::escape(t.to_s) }] * '/'
0
   end
0
 
0
   def accept_comments?
...
45
46
47
48
49
 
 
50
51
52
53
54
55
 
 
 
 
56
57
58
...
180
181
182
183
184
 
...
45
46
47
 
 
48
49
50
51
52
 
 
 
53
54
55
56
57
58
59
...
181
182
183
 
184
185
0
@@ -45,14 +45,15 @@ context "Site" do
0
   end
0
 
0
   specify "should generate search url" do
0
- assert_equal '/search?q=abc', sites(:first).search_url('abc')
0
- assert_equal '/search?q=abc&page=2', sites(:first).search_url('abc', 2)
0
+ assert_equal '/search?q=abc', sites(:first).search_url('abc')
0
+ assert_equal '/search?q=abc&amp;page=2', sites(:first).search_url('abc', 2)
0
   end
0
   
0
   specify "should generate tag url" do
0
- assert_equal '/tags', sites(:first).tag_url
0
- assert_equal '/tags/foo', sites(:first).tag_url('foo')
0
- assert_equal '/tags/foo/bar', sites(:first).tag_url('foo', 'bar')
0
+ assert_equal '/tags', sites(:first).tag_url
0
+ assert_equal '/tags/foo', sites(:first).tag_url('foo')
0
+ assert_equal '/tags/foo/bar', sites(:first).tag_url('foo', 'bar')
0
+ assert_equal '/tags/foo%20bar', sites(:first).tag_url('foo bar')
0
   end
0
 
0
   specify "should order sections in site" do
0
@@ -180,4 +181,4 @@ context "Site Validations" do
0
     assert_valid @site
0
     assert_equal 'article/:id', @site.permalink_style
0
   end
0
-end
0
\ No newline at end of file
0
+end
...
89
90
91
92
93
94
 
 
 
 
95
96
97
...
99
100
101
102
103
 
 
104
105
106
...
213
214
215
216
217
 
...
89
90
91
 
 
 
92
93
94
95
96
97
98
...
100
101
102
 
 
103
104
105
106
107
...
214
215
216
 
217
218
0
@@ -89,9 +89,10 @@ context "Url Filters" do
0
   end
0
 
0
   specify "should generate tag urls" do
0
- assert_equal "/tags", tag_url
0
- assert_equal "/tags/foo", tag_url('foo')
0
- assert_equal "/tags/foo/bar", tag_url('foo', 'bar')
0
+ assert_equal "/tags", tag_url
0
+ assert_equal "/tags/foo", tag_url('foo')
0
+ assert_equal "/tags/foo/bar", tag_url('foo', 'bar')
0
+ assert_equal '/tags/foo%20bar', tag_url('foo bar')
0
   end
0
   
0
   specify "should generate tag links" do
0
@@ -99,8 +100,8 @@ context "Url Filters" do
0
   end
0
   
0
   specify "should generate search urls" do
0
- assert_equal '/search?q=abc', search_url('abc')
0
- assert_equal '/search?q=abc&page=2', search_url('abc', 2)
0
+ assert_equal '/search?q=abc', search_url('abc')
0
+ assert_equal '/search?q=abc&amp;page=2', search_url('abc', 2)
0
   end
0
   
0
   specify "should generate atom auto discovery tag" do
0
@@ -213,4 +214,4 @@ context "Article Url Filters" do
0
     content = changes_feed(@article, "Welcome Changes")
0
     assert_match /title="Welcome Changes"/, content
0
   end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.