File tree Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Expand file tree Collapse file tree 1 file changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -1259,6 +1259,8 @@ def read_e_o_c_d(io) #:nodoc:
1259
1259
@cdirOffset = ZipEntry ::read_zip_long ( buf )
1260
1260
commentLength = ZipEntry ::read_zip_short ( buf )
1261
1261
@comment = buf . read ( commentLength )
1262
+ # remove trailing \n or \f or \r symbol
1263
+ buf . gsub! ( /\s / , '' )
1262
1264
raise ZipError , "Zip consistency problem while reading eocd structure" unless buf . size == 0
1263
1265
end
1264
1266
@@ -1284,26 +1286,12 @@ def get_e_o_c_d(io) #:nodoc:
1284
1286
io . seek ( -MAX_END_OF_CENTRAL_DIRECTORY_STRUCTURE_SIZE , IO ::SEEK_END )
1285
1287
rescue Errno ::EINVAL
1286
1288
io . seek ( 0 , IO ::SEEK_SET )
1287
- rescue Errno ::EFBIG # FreeBSD 4.9 raise Errno::EFBIG instead of Errno::EINVAL
1288
- io . seek ( 0 , IO ::SEEK_SET )
1289
- end
1290
-
1291
- # 'buf = io.read' substituted with lump of code to work around FreeBSD 4.5 issue
1292
- retried = false
1293
- buf = nil
1294
- begin
1295
- buf = io . read
1296
- rescue Errno ::EFBIG # FreeBSD 4.5 may raise Errno::EFBIG
1297
- raise if ( retried )
1298
- retried = true
1299
-
1300
- io . seek ( 0 , IO ::SEEK_SET )
1301
- retry
1302
1289
end
1303
1290
1291
+ buf = io . read
1304
1292
sigIndex = buf . rindex ( [ END_OF_CENTRAL_DIRECTORY_SIGNATURE ] . pack ( 'V' ) )
1305
1293
raise ZipError , "Zip end of central directory signature not found" unless sigIndex
1306
- buf = buf . slice! ( ( sigIndex +4 ) ... ( buf . size ) )
1294
+ buf = buf . slice! ( ( sigIndex +4 ) ..( buf . size ) )
1307
1295
def buf . read ( count )
1308
1296
slice! ( 0 , count )
1309
1297
end
You can’t perform that action at this time.
0 commit comments