libdolt 0.33.13 → 0.33.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +3 -2
  3. data/lib/libdolt/git/commit.rb +6 -3
  4. data/lib/libdolt/html_escape.rb +27 -0
  5. data/lib/libdolt/version.rb +1 -1
  6. data/lib/libdolt/view/blob.rb +1 -6
  7. data/lib/libdolt.rb +1 -0
  8. data/test/fixtures/dolt-test-repo.git/info/refs +2 -0
  9. data/test/fixtures/dolt-test-repo.git/objects/19/6e6f2a91c6ab8c7fc2f3cd5124cedb1a2fc83a +3 -0
  10. data/test/fixtures/dolt-test-repo.git/objects/info/packs +2 -0
  11. data/test/fixtures/dolt-test-repo.git/objects/pack/pack-a50f04f936dd57b638b5b97a5eeaf8860c97ae2e.idx +0 -0
  12. data/test/fixtures/dolt-test-repo.git/objects/pack/pack-a50f04f936dd57b638b5b97a5eeaf8860c97ae2e.pack +0 -0
  13. data/test/fixtures/dolt-test-repo.git/packed-refs +3 -0
  14. data/test/libdolt/git/repository_test.rb +21 -0
  15. metadata +9 -29
  16. data/test/fixtures/dolt-test-repo.git/objects/03/0bc1fa37aac317a5d38fbb4f3a6d22b34c6eba +0 -0
  17. data/test/fixtures/dolt-test-repo.git/objects/07/4e4c198421bfc8a1bf9a9c0fc117c4569ba0bd +0 -0
  18. data/test/fixtures/dolt-test-repo.git/objects/12/67a0fbd3ec606c20f3f1dca1f53bb9505ba9b5 +0 -0
  19. data/test/fixtures/dolt-test-repo.git/objects/13/0ddb17c01e1c283669d012ad9e7e92fa1af5b1 +0 -0
  20. data/test/fixtures/dolt-test-repo.git/objects/1a/f9b62325e53f0e9aff8ed80d919b73a6fd18e2 +0 -0
  21. data/test/fixtures/dolt-test-repo.git/objects/26/4c348a80906538018616fa16fc35d04bdf38b0 +0 -0
  22. data/test/fixtures/dolt-test-repo.git/objects/28/5f85e1dae8796d8780106b3986ba47cf989bca +0 -0
  23. data/test/fixtures/dolt-test-repo.git/objects/36/855d2d2899aa1044c4ea8eba229d7460cc083a +0 -0
  24. data/test/fixtures/dolt-test-repo.git/objects/38/3216e07edec271936c7fd87b69c346511aedb2 +0 -2
  25. data/test/fixtures/dolt-test-repo.git/objects/60/eebb9021a6ce7d582c2f2d4aa5bfb3672150ae +0 -2
  26. data/test/fixtures/dolt-test-repo.git/objects/64/bb41b95d4f696fc9e22ef9718fc2eaf0b6ccac +0 -2
  27. data/test/fixtures/dolt-test-repo.git/objects/85/026eda8302b98fa54cc24445a118028865a2e2 +0 -0
  28. data/test/fixtures/dolt-test-repo.git/objects/89/cd7e9d4564928de6b803b36c6e3d081c8d9ca1 +0 -0
  29. data/test/fixtures/dolt-test-repo.git/objects/a1/2abf5b47584c947cc7f09b27e5895644c5524d +0 -0
  30. data/test/fixtures/dolt-test-repo.git/objects/b4/0c249db94476cac7fa91a9d6491c0faf21ec21 +0 -0
  31. data/test/fixtures/dolt-test-repo.git/objects/c0/35ba24bb3bed31589bc6736ca9b116175eb723 +0 -0
  32. data/test/fixtures/dolt-test-repo.git/objects/c8/cc83f1a1fc3640fce14ab73d4fa4b22b6211d8 +0 -0
  33. data/test/fixtures/dolt-test-repo.git/objects/ca/d2309100006f94967cdafe678356b96bb098a5 +0 -0
  34. data/test/fixtures/dolt-test-repo.git/objects/cd/104f8b749c206e7faef1cb7c03f453cbb1aa57 +0 -0
  35. data/test/fixtures/dolt-test-repo.git/objects/cd/888aef50e3742885630ea4aa8c05f12b5518f4 +0 -0
  36. data/test/fixtures/dolt-test-repo.git/objects/d1/f94fb68cf34f7f121a949e89e09d1a8c1b3825 +0 -0
  37. data/test/fixtures/dolt-test-repo.git/objects/de/dbf2faa4f522716ab727e4325a3d75772e137b +0 -0
  38. data/test/fixtures/dolt-test-repo.git/objects/e8/d33ae69b8c4d3df1e8fad4733d69720b176849 +0 -1
  39. data/test/fixtures/dolt-test-repo.git/objects/e9/0021f89616ddf86855d05337c188408d3b417e +0 -0
  40. data/test/fixtures/dolt-test-repo.git/objects/fc/5f5fb50b435e183925b341909610aace90a413 +0 -0
  41. data/test/fixtures/dolt-test-repo.git/refs/heads/master +0 -1
  42. data/test/fixtures/dolt-test-repo.git/refs/tags/testable-tag +0 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZTdkM2UyN2IxMGY3OGM2OTYzMDA0OGYxNzkyMDg4MGRkN2VjNjU0OA==
4
+ MzM5MGFmMDljMzEyY2U1Y2FmNjY5NDNmYmMwNDY2NjRhODE0MzQzZA==
5
5
  data.tar.gz: !binary |-
6
- MGVkMjRmYjVmNjQwMTQwODFiYTI2MDZkNjk1MjVlNTgyYTRkNWIyMQ==
6
+ MjlmZjFiYzAxYTczY2RlNTVlZTQ0OTM1NzQxNTZmNzFkZGE0ZGZjNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjNlYWI1NDRjMjcyZDViMjA5OTZiNDNiOWY4OTM2NDhiY2I2NjllZWUyMGU3
10
- MzdjMmUwNTBhMGQzZmVlNjk2YWYyZGRmNGM3OTQ3ZWE0N2M1MjEwZmNjNjZh
11
- NjNiOTk1ZmM0YjdlYWMzNzhlMjhmNGZkNmMyZWYyZTIyMmQ0NWE=
9
+ NDgzZTc4OGIwMjBhMzcyY2Y0NDk0NmJmZTk3NjE0OWM5MzRkNDRhYWMxYWI4
10
+ Mjc4MjkwMWE4Y2MwZGQ5YTZkNTRiN2I0MDc3NmMyZjQ3ZGI2ZDNmNGNlMjFj
11
+ Yjk2MjQwMTNkYWVhOWZmOGMyZmNhOWFlNGMyODIxNGI1MWI5OWM=
12
12
  data.tar.gz: !binary |-
13
- M2QxNDc0ZDBhMWMxZGM0NjAwMDcxYTc1ODEwNTg2MTNlZDM2ODU1YzdlYTYz
14
- MWQ2NjA4M2NlMjdmYzQ0M2Y4NjYzNzk5ZTBiOWY2YTFlY2U4OTU4ZDU4Nzlh
15
- OWZiYWUyYmE4MGRmOWZkZjMzMDIzMTFhNGZhNzZkNTE4MzY1YWM=
13
+ NjBmYmRiOWRkZjAxMjBjNzYyZGIxNjg5NThiNmQyOWQzNzFlOGExYjViNTRk
14
+ MzhmYjNiZWE3YjVjNjU3ZDcwMjdmZWY5NTlhYmI3YjkzMDI5ZTc5ZGQ1Mjkz
15
+ NDM1NmQxNzFjMTU4NGQxN2FlOWJlMmQ1OTQxNzhhMmE0MmNiMWI=
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
- coverage
2
- test/reports
3
1
  /Gemfile.lock
2
+ coverage
4
3
  pkg
4
+ tags
5
+ test/reports
@@ -45,7 +45,9 @@ module Dolt
45
45
  case key
46
46
  when :author
47
47
  pieces = value.match(/(.*)\s<(.*)>/)
48
- value = { :name => pieces[1], :email => pieces[2] }
48
+ name = HTMLEscape.entityfy(pieces[1])
49
+ email = HTMLEscape.entityfy(pieces[2])
50
+ value = { :name => name, :email => email }
49
51
  when :date
50
52
  value = Time.parse(value)
51
53
  end
@@ -56,7 +58,8 @@ module Dolt
56
58
  def self.extract_commit_summary(lines)
57
59
  summary = lines.shift
58
60
  lines.shift if lines.first == ""
59
- summary.sub(/^ /, "")
61
+ summary = summary.sub(/^ /, "")
62
+ HTMLEscape.entityfy(summary)
60
63
  end
61
64
 
62
65
  def self.extract_commit_message(lines)
@@ -66,7 +69,7 @@ module Dolt
66
69
  message << lines.shift
67
70
  end
68
71
 
69
- message
72
+ HTMLEscape.entityfy(message)
70
73
  end
71
74
  end
72
75
  end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+ #--
3
+ # Copyright (C) 2014 Gitorious AS
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Affero General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Affero General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Affero General Public License
16
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ #++
18
+ require "htmlentities"
19
+
20
+ module Dolt
21
+ module HTMLEscape
22
+ def self.entityfy(content)
23
+ @coder ||= HTMLEntities.new
24
+ @coder.encode(content)
25
+ end
26
+ end
27
+ end
@@ -17,5 +17,5 @@
17
17
  #++
18
18
 
19
19
  module Dolt
20
- VERSION = "0.33.13"
20
+ VERSION = "0.33.14"
21
21
  end
@@ -24,11 +24,6 @@ module Dolt
24
24
  !content[0...(content.length-1)].index("\000").nil?
25
25
  end
26
26
 
27
- def entityfy(content)
28
- @coder ||= HTMLEntities.new
29
- @coder.encode(content)
30
- end
31
-
32
27
  def format_blob(path, content, repo = nil, ref = nil)
33
28
  return format_binary_blob(path, content, repo, ref) if binary?(content)
34
29
  format_text_blob(path, content, repo, ref)
@@ -48,7 +43,7 @@ The content you're attempting to browse appears to be binary.
48
43
  end
49
44
 
50
45
  def format_text_blob(path, content, repository = nil, ref = nil)
51
- multiline(entityfy(content))
46
+ multiline(HTMLEscape.entityfy(content))
52
47
  end
53
48
 
54
49
  def format_whitespace(text)
data/lib/libdolt.rb CHANGED
@@ -19,6 +19,7 @@ require "libdolt/version"
19
19
  require "libdolt/disk_repo_resolver"
20
20
  require "libdolt/repository_lookup"
21
21
  require "libdolt/controller_actions"
22
+ require "libdolt/html_escape"
22
23
  require "libdolt/view"
23
24
  require "force_utf8/encode"
24
25
 
@@ -0,0 +1,2 @@
1
+ 52d7029425ff0556ff659e570f71393b6c28ac9c refs/heads/master
2
+ fc5f5fb50b435e183925b341909610aace90a413 refs/tags/testable-tag
@@ -0,0 +1,3 @@
1
+ xE��N�0EY�+Fݰ@j�J\K!B,���ƓqǑ���S(��ѹJ1 h��� !գ��8V�6��Z)RLMm�'����f�<-@�&�5��h�� �[:�Z������%exI �1C[(�%��.��1����Ё�G�g
2
+ Q��Ņ3��G8
3
+ n�'�5F���۴BW�oE.�\}�b�
@@ -0,0 +1,2 @@
1
+ P pack-a50f04f936dd57b638b5b97a5eeaf8860c97ae2e.pack
2
+
@@ -0,0 +1,3 @@
1
+ # pack-refs with: peeled fully-peeled
2
+ 52d7029425ff0556ff659e570f71393b6c28ac9c refs/heads/master
3
+ fc5f5fb50b435e183925b341909610aace90a413 refs/tags/testable-tag
@@ -163,6 +163,27 @@ describe Dolt::Git::Repository do
163
163
  }]
164
164
  assert_equal expected, log
165
165
  end
166
+
167
+ it "escapes summary and message" do
168
+ log = @repository.tree_history("52d702", "")
169
+
170
+ expected = {
171
+ :type => :blob,
172
+ :oid => "e2bd58a7c13c12a39fe882b773e00b66438a9451",
173
+ :filemode => 33188,
174
+ :name => "README.org",
175
+ :history => [{
176
+ :oid => "52d7029425ff0556ff659e570f71393b6c28ac9c",
177
+ :author => { :name => "Foo O&apos;Bar",
178
+ :email => 'script src=&quot;foobar.js&quot;/' },
179
+ :summary => "I&apos;m an &lt;script&gt;unsafe&lt;/script&gt; summary",
180
+ :date => Time.parse("2014-01-09 13:16:03 +0200"),
181
+ :message => " I&apos;m a &lt;script&gt;scary&lt;/script&gt; message"
182
+ }]
183
+ }
184
+
185
+ assert_equal expected, log[1]
186
+ end
166
187
  end
167
188
 
168
189
  describe "#readmes" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libdolt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.13
4
+ version: 0.33.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-02 00:00:00.000000000 Z
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -201,6 +201,7 @@ files:
201
201
  - lib/libdolt/git/repository.rb
202
202
  - lib/libdolt/git/submodule.rb
203
203
  - lib/libdolt/git/tree.rb
204
+ - lib/libdolt/html_escape.rb
204
205
  - lib/libdolt/repository_lookup.rb
205
206
  - lib/libdolt/version.rb
206
207
  - lib/libdolt/view.rb
@@ -226,48 +227,27 @@ files:
226
227
  - test/fixtures/dolt-test-repo.git/config
227
228
  - test/fixtures/dolt-test-repo.git/description
228
229
  - test/fixtures/dolt-test-repo.git/info/exclude
229
- - test/fixtures/dolt-test-repo.git/objects/03/0bc1fa37aac317a5d38fbb4f3a6d22b34c6eba
230
+ - test/fixtures/dolt-test-repo.git/info/refs
230
231
  - test/fixtures/dolt-test-repo.git/objects/04/76d88d4c60823927c52f872ff09e7f84fb3549
231
- - test/fixtures/dolt-test-repo.git/objects/07/4e4c198421bfc8a1bf9a9c0fc117c4569ba0bd
232
- - test/fixtures/dolt-test-repo.git/objects/12/67a0fbd3ec606c20f3f1dca1f53bb9505ba9b5
233
- - test/fixtures/dolt-test-repo.git/objects/13/0ddb17c01e1c283669d012ad9e7e92fa1af5b1
234
232
  - test/fixtures/dolt-test-repo.git/objects/19/344f9121eb8871e814efd9534de9a0891631da
233
+ - test/fixtures/dolt-test-repo.git/objects/19/6e6f2a91c6ab8c7fc2f3cd5124cedb1a2fc83a
235
234
  - test/fixtures/dolt-test-repo.git/objects/19/a9bccbaadfa2e25f74584c3f13caebd600d23f
236
- - test/fixtures/dolt-test-repo.git/objects/1a/f9b62325e53f0e9aff8ed80d919b73a6fd18e2
237
235
  - test/fixtures/dolt-test-repo.git/objects/1e/cafd67fb977dee90345f0503b0ecc2e62e01d1
238
236
  - test/fixtures/dolt-test-repo.git/objects/1f/5508d7182176fa7584096d24d3b5f288a101ab
239
- - test/fixtures/dolt-test-repo.git/objects/26/4c348a80906538018616fa16fc35d04bdf38b0
240
- - test/fixtures/dolt-test-repo.git/objects/28/5f85e1dae8796d8780106b3986ba47cf989bca
241
237
  - test/fixtures/dolt-test-repo.git/objects/2b/f4bb63d412e8f5730c0fe6da5c6e5e913f26fa
242
- - test/fixtures/dolt-test-repo.git/objects/36/855d2d2899aa1044c4ea8eba229d7460cc083a
243
- - test/fixtures/dolt-test-repo.git/objects/38/3216e07edec271936c7fd87b69c346511aedb2
244
238
  - test/fixtures/dolt-test-repo.git/objects/3d/2cf127812ba38c74a69ea9f691768d68769df4
245
239
  - test/fixtures/dolt-test-repo.git/objects/4f/3b300a2d261163a8b0753aacdd378e3b73b917
246
240
  - test/fixtures/dolt-test-repo.git/objects/55/b0879bb70392b5754af3fe2b9ca2b98d22f3fb
247
- - test/fixtures/dolt-test-repo.git/objects/60/eebb9021a6ce7d582c2f2d4aa5bfb3672150ae
248
- - test/fixtures/dolt-test-repo.git/objects/64/bb41b95d4f696fc9e22ef9718fc2eaf0b6ccac
249
241
  - test/fixtures/dolt-test-repo.git/objects/75/937fa642851b518ccab55f7880d02e854e67f7
250
- - test/fixtures/dolt-test-repo.git/objects/85/026eda8302b98fa54cc24445a118028865a2e2
251
- - test/fixtures/dolt-test-repo.git/objects/89/cd7e9d4564928de6b803b36c6e3d081c8d9ca1
252
242
  - test/fixtures/dolt-test-repo.git/objects/96/68141a1c781cf4ec352cca52d0cebf8a04fc50
253
- - test/fixtures/dolt-test-repo.git/objects/a1/2abf5b47584c947cc7f09b27e5895644c5524d
254
- - test/fixtures/dolt-test-repo.git/objects/b4/0c249db94476cac7fa91a9d6491c0faf21ec21
255
- - test/fixtures/dolt-test-repo.git/objects/c0/35ba24bb3bed31589bc6736ca9b116175eb723
256
- - test/fixtures/dolt-test-repo.git/objects/c8/cc83f1a1fc3640fce14ab73d4fa4b22b6211d8
257
- - test/fixtures/dolt-test-repo.git/objects/ca/d2309100006f94967cdafe678356b96bb098a5
258
- - test/fixtures/dolt-test-repo.git/objects/cd/104f8b749c206e7faef1cb7c03f453cbb1aa57
259
- - test/fixtures/dolt-test-repo.git/objects/cd/888aef50e3742885630ea4aa8c05f12b5518f4
260
- - test/fixtures/dolt-test-repo.git/objects/d1/f94fb68cf34f7f121a949e89e09d1a8c1b3825
261
243
  - test/fixtures/dolt-test-repo.git/objects/da/dd1e7ec0c822ba96fcee5d064bea66a7be3d5a
262
- - test/fixtures/dolt-test-repo.git/objects/de/dbf2faa4f522716ab727e4325a3d75772e137b
263
244
  - test/fixtures/dolt-test-repo.git/objects/df/d46204a2c44405a2591c2dbc7e73d1a81b5334
264
245
  - test/fixtures/dolt-test-repo.git/objects/e5/d842ae3035a402d34b531ae5117bc03b50ac77
265
246
  - test/fixtures/dolt-test-repo.git/objects/e7/271e0e558b55397698b8c73acf13bd7429ebb3
266
- - test/fixtures/dolt-test-repo.git/objects/e8/d33ae69b8c4d3df1e8fad4733d69720b176849
267
- - test/fixtures/dolt-test-repo.git/objects/e9/0021f89616ddf86855d05337c188408d3b417e
268
- - test/fixtures/dolt-test-repo.git/objects/fc/5f5fb50b435e183925b341909610aace90a413
269
- - test/fixtures/dolt-test-repo.git/refs/heads/master
270
- - test/fixtures/dolt-test-repo.git/refs/tags/testable-tag
247
+ - test/fixtures/dolt-test-repo.git/objects/info/packs
248
+ - test/fixtures/dolt-test-repo.git/objects/pack/pack-a50f04f936dd57b638b5b97a5eeaf8860c97ae2e.idx
249
+ - test/fixtures/dolt-test-repo.git/objects/pack/pack-a50f04f936dd57b638b5b97a5eeaf8860c97ae2e.pack
250
+ - test/fixtures/dolt-test-repo.git/packed-refs
271
251
  - test/libdolt/controller_actions_test.rb
272
252
  - test/libdolt/disk_repo_resolver_test.rb
273
253
  - test/libdolt/git/archiver_test.rb
@@ -1,2 +0,0 @@
1
- x��Aj�0@Ѯu��ʌlK���]n1���X.���Bz�l���e�����G[U�:L)�$%�c�\HH�SP��f&�C$�˫�������g\���j��,V9ct",��ڴ�p�ֲ��N��u�
2
- ;����_�U��Nj���>�"y�6}3c)A�W���m���c���S�
@@ -1,2 +0,0 @@
1
- x��AJ�0�a�9����$} <Dq�-&� ��D����� �~��_Ǿo|H�0M�� 5�%`S� ��54 ���x��ܗ�'4�-���F����e� ��ZF �N�����c;�&��*��w����ŧ>���F�S������N�gƽ�
2
- �U�Q�Os߄P�
@@ -1,2 +0,0 @@
1
- x��A
2
- �0@Q�9��I�I&ŝ�H&SZ���q����}���y��i�H�I�w���L��ِ��Gd� �H����I|́���w�T��->�ѹ#0��lü�yXƵ���eR]�žv��wu>@g������h��3��ό:��k�����7��P
@@ -1 +0,0 @@
1
- x���J1 �a�}��$MMg�&x�
@@ -1 +0,0 @@
1
- cd104f8b749c206e7faef1cb7c03f453cbb1aa57
@@ -1 +0,0 @@
1
- fc5f5fb50b435e183925b341909610aace90a413