gitlab-grit 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50d2332e9f83f182b9fc5a1178ab6ef11db8dc22
4
- data.tar.gz: 8e2536c308e1b3b5ff7d1ccf98478f47f1983233
3
+ metadata.gz: a8c6f512f0477d03aeb48a9626fa774dd9f062d4
4
+ data.tar.gz: 284e6614616088e8e0f607240ae231ad89126b43
5
5
  SHA512:
6
- metadata.gz: c3a1a06490065b3a52ff7151f1ea28231c8009bcd34c6e946f48561eb5a24bfad3563f6b1c49ec3a8dbfab41241803a509a52295acbc582adc49639dcc8b2a55
7
- data.tar.gz: 5f46d54c9781d90a2743aedd90da69ab4983f48cef58a402e8b27225774b3b2da6fbc7cdb4bf7e584159eb31ffd76e01daf8e61ce8b1b9f2aa679e30d1dfdb21
6
+ metadata.gz: 348f57115329b50107c46e2a12f9d1d100d7c7aa69b2c6949fa3a15734bdff0098523f44ad57df11e26873037311628e4957d3b7c806b6454a386e1fc4d7aa83
7
+ data.tar.gz: 40fd462abe147a14c0883756a55ba11a69c054df8c87233d9271f98beabed8949d6db886ebd7503dc90d53285db413c53cda738e52d3649a9c28f7722f177939
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 2.7.3
@@ -683,7 +683,9 @@ module Grit
683
683
  end
684
684
 
685
685
  def self.add_file(name, contents)
686
- File.open(name, 'w') do |f|
686
+ path = File.join(Dir.pwd, name)
687
+ raise "Invalid path: #{path}" unless File.absolute_path(path) == path
688
+ File.open(path, 'w') do |f|
687
689
  f.write contents
688
690
  end
689
691
  end
data/lib/grit/git.rb CHANGED
@@ -90,9 +90,13 @@ module Grit
90
90
 
91
91
  def self.with_timeout(timeout = 10)
92
92
  old_timeout = Grit::Git.git_timeout
93
- Grit::Git.git_timeout = timeout
94
- yield
95
- Grit::Git.git_timeout = old_timeout
93
+
94
+ begin
95
+ Grit::Git.git_timeout = timeout
96
+ yield
97
+ ensure
98
+ Grit::Git.git_timeout = old_timeout
99
+ end
96
100
  end
97
101
 
98
102
  attr_accessor :git_dir, :bytes_read, :work_tree
@@ -113,7 +117,9 @@ module Grit
113
117
  #
114
118
  # Returns Boolean
115
119
  def fs_exist?(file)
116
- File.exist?(File.join(self.git_dir, file))
120
+ path = File.join(self.git_dir, file)
121
+ raise "Invalid path: #{path}" unless File.absolute_path(path) == path
122
+ File.exist?(path)
117
123
  end
118
124
 
119
125
  # Read a normal file from the filesystem.
@@ -121,7 +127,9 @@ module Grit
121
127
  #
122
128
  # Returns the String contents of the file
123
129
  def fs_read(file)
124
- File.read(File.join(self.git_dir, file))
130
+ path = File.join(self.git_dir, file)
131
+ raise "Invalid path: #{path}" unless File.absolute_path(path) == path
132
+ File.read(path)
125
133
  end
126
134
 
127
135
  # Write a normal file to the filesystem.
@@ -131,6 +139,7 @@ module Grit
131
139
  # Returns nothing
132
140
  def fs_write(file, contents)
133
141
  path = File.join(self.git_dir, file)
142
+ raise "Invalid path: #{path}" unless File.absolute_path(path) == path
134
143
  FileUtils.mkdir_p(File.dirname(path))
135
144
  File.open(path, 'w') do |f|
136
145
  f.write(contents)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-grit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-10 00:00:00.000000000 Z
13
+ date: 2014-12-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: charlock_holmes
@@ -157,4 +157,3 @@ signing_key:
157
157
  specification_version: 4
158
158
  summary: Ruby Git bindings.
159
159
  test_files: []
160
- has_rdoc: