Skip to content

Commit

Permalink
- Made some media mimetypes unsupported because WKWebview does not su…
Browse files Browse the repository at this point in the history
…pport

them. (wmv, ogg, avi, flv)
- Made some image mimetypes to open inside WKWebView (svg, gif)
  • Loading branch information
pablocarmu committed Oct 23, 2018
1 parent 7302ae8 commit a6f2421
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ownCloud/Viewer/ImageDisplayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extension ImageDisplayViewController: DisplayExtension {
static var customMatcher: OCExtensionCustomContextMatcher? = { (context, defaultPriority) in
do {
let location = context!.location.identifier.rawValue
let supportedFormatsRegex = try NSRegularExpression(pattern: "\\A((image/))", options: .caseInsensitive)
let supportedFormatsRegex = try NSRegularExpression(pattern: "\\A((image/(?!(gif|svg*))))", options: .caseInsensitive)
let matches = supportedFormatsRegex.numberOfMatches(in: location, options: .reportCompletion, range: NSRange(location: 0, length: location.count))

if matches > 0 {
Expand Down
2 changes: 1 addition & 1 deletion ownCloud/Viewer/WebViewDisplayViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extension WebViewDisplayViewController: DisplayExtension {
static var customMatcher: OCExtensionCustomContextMatcher? = { (context, defaultPriority) in
do {
let location = context!.location.identifier.rawValue
let supportedFormatsRegex = try NSRegularExpression(pattern: "\\A((text/)|(video/)|(audio/)|(application/(vnd.|ms))(ms|openxmlformats)?)", options: .caseInsensitive)
let supportedFormatsRegex = try NSRegularExpression(pattern: "\\A((text/)|(video/(?!(x-flv|ogg|x-ms-wmv|x-msvideo)))|(audio/)|(image/(gif|svg))|(application/(vnd.|ms))(?!oasis)(ms|openxmlformats)?)", options: .caseInsensitive)
let matches = supportedFormatsRegex.numberOfMatches(in: location, options: .reportCompletion, range: NSRange(location: 0, length: location.count))

if matches > 0 {
Expand Down

0 comments on commit a6f2421

Please sign in to comment.