mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add Blob#vendored?
This commit is contained in:
@@ -3,6 +3,7 @@ require 'linguist/mime'
|
||||
require 'linguist/pathname'
|
||||
|
||||
require 'escape_utils'
|
||||
require 'yaml'
|
||||
|
||||
module Linguist
|
||||
module BlobHelper
|
||||
@@ -65,6 +66,13 @@ module Linguist
|
||||
['.xib', '.nib', '.pbxproj'].include?(pathname.extname)
|
||||
end
|
||||
|
||||
vendored_paths = YAML.load_file(File.expand_path("../vendor.yml", __FILE__))
|
||||
VendoredRegexp = Regexp.new(vendored_paths.join('|'))
|
||||
|
||||
def vendored?
|
||||
name =~ VendoredRegexp
|
||||
end
|
||||
|
||||
# Determine if the blob contains bad content that can be used for various
|
||||
# cross site attacks. Right now this is limited to flash files -- the flash
|
||||
# plugin ignores the response content type and treats any URL as flash
|
||||
|
||||
Reference in New Issue
Block a user