cocoapods-privacy 0.5.1 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 517e776e5936689d58b230349587b62cae56b02f1204934bed0620cf1117785c
4
- data.tar.gz: 4ece159c7db2ff224dd1958a5707911410f4f71fb00e337aa12493c53fb4bcdb
3
+ metadata.gz: ce64995902a9af9f853ce1d4018748b714f47a771289f8da33b1c9827a0fef59
4
+ data.tar.gz: 7e7203d0324d3ccb00c1219fdbcf14edb32074f8d11099e1fe9d5b0117481ba4
5
5
  SHA512:
6
- metadata.gz: 5404d58d4e398f9d7074f252960546e9272912ee536687ef6d5c2d9f8577888916e54b5d36399512693b04ebe15aac1b7a7e358236215cf59112a174ffef8dbc
7
- data.tar.gz: 4169159705cf07dd3f8e994c26bc9b3c65593d680434dc0dea23787fee59c51113559bab1652fcfa9c75e24987fac52fcb257a66bc0f280eae19a313ea068375
6
+ metadata.gz: 15cde8d4d59ac209bb6077aba1fd0f4fd05b84f63a34c4b1eb5400f2629062fd698d4160cb1fe53d15886eda618e949b15bfda03b801926f8c1ab31bd6753db8
7
+ data.tar.gz: e51e757e36de17ce7142d9b4fbefb3fc244d0f57ab9cb02302bde26a7e8ae749f013535574b5036082c2d8fc6fd0735a91c8939c461a626502fd652ea8f68cab
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPrivacy
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.3"
3
3
  end
@@ -187,9 +187,23 @@ module PrivacyHunter
187
187
  File.utime(File.atime(local_file_path), Time.parse(remote_file_time), local_file_path)
188
188
  end
189
189
 
190
+
191
+
192
+ #💡💡💡以下是 invalid byte sequence in UTF-8 错误复现 的数据代码
193
+ # File.write("/Users/xxx/.cache/cocoapods-privacy/privacy/file.txt", "vandflyver \xC5rhus \n
194
+
195
+ # \n
196
+
197
+ # \\n
198
+
199
+ # vandflyver
200
+ # \xC5rhus
201
+ # ")
190
202
  # 文件是否包含内容
191
203
  def self.contains_apis?(file_path, apis)
192
- file_content = File.read(file_path)
204
+
205
+ #使用UTF-8 读取,无法读取的会被默认处理,修复 https://github.com/ymoyao/cocoapods-privacy/issues/7
206
+ file_content = File.read(file_path, encoding: 'UTF-8', invalid: :replace, undef: :replace)
193
207
 
194
208
  #核心文件检查段落注释 /* */
195
209
  file_extension = File.extname(file_path).downcase
@@ -211,11 +225,13 @@ module PrivacyHunter
211
225
  in_block_comment_count = 0
212
226
  in_block_comment = false
213
227
  lines.each do |line|
214
- next if line.strip.empty? #忽略空行
215
- next if line.strip.start_with?('//') #忽略单行
228
+
229
+ line_scrub = line.scrub("")
230
+ next if line_scrub.strip.empty? #忽略空行
231
+ next if line_scrub.strip.start_with?('//') #忽略单行
216
232
 
217
233
  apis.each do |keyword, value|
218
- if line.include?(keyword)
234
+ if line_scrub.include?(keyword)
219
235
  apis_found[keyword] = value
220
236
  end
221
237
  end
@@ -238,10 +254,12 @@ module PrivacyHunter
238
254
  count_comments = 0
239
255
 
240
256
  lines.each do |line|
241
- next if line.strip.empty? #忽略空行
242
- next if line.strip.start_with?('//') && !in_block_comment #忽略单行
243
257
 
244
- chars = line.chars
258
+ line_scrub = line.scrub("")
259
+ next if line_scrub.strip.empty? #忽略空行
260
+ next if line_scrub.strip.start_with?('//') && !in_block_comment #忽略单行
261
+
262
+ chars = line_scrub.chars
245
263
  index = 0
246
264
  while index < chars.size
247
265
  char = chars[index]
@@ -294,7 +312,7 @@ module PrivacyHunter
294
312
 
295
313
  if !in_block_comment && !in_line_comment
296
314
  apis.each do |keyword, value|
297
- if line.include?(keyword)
315
+ if line_scrub.include?(keyword)
298
316
  apis_found[keyword] = value
299
317
  end
300
318
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-privacy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - youhui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-02 00:00:00.000000000 Z
11
+ date: 2024-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler