Skip to content

Commit

Permalink
Swiftlint Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-rootkit committed Sep 3, 2024
1 parent 250dc18 commit a9e3376
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions DuckDuckGo/Common/Utilities/URLTokenValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import Foundation


/**
`URLTokenValidator` is responsible for generating and validating URL signatures to securely pass URLs around in Special Pages.

Expand Down Expand Up @@ -144,13 +143,13 @@ public class URLTokenValidator {
var base64String = base64URLString
.replacingOccurrences(of: "-", with: "+")
.replacingOccurrences(of: "_", with: "/")

// Add padding if necessary
let paddingLength = 4 - (base64String.count % 4)
if paddingLength < 4 {
base64String.append(contentsOf: repeatElement("=", count: paddingLength))
}

// Decode the Base64 string to data
return Data(base64Encoded: base64String)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension SpecialErrorPageTabExtension: NavigationResponder {
let errorType = PhishingDetectionError.detected.localizedDescription
if isMalicious {
errorPageType = .phishing
//self.specialErrorPageUserScript?.errorData.kind = "phishing"
// self.specialErrorPageUserScript?.errorData.kind = "phishing"
if let mainFrameTarget = navigationAction.mainFrameTarget {
failingURL = url
let domain: String = url.host ?? url.toString(decodePunycode: true, dropScheme: true, dropTrailingSlash: true)
Expand Down Expand Up @@ -183,7 +183,7 @@ extension SpecialErrorPageTabExtension: NavigationResponder {
shouldBypassSSLError = false
return .credential(credential)
}

@MainActor
func generateErrorPageURL(_ url: URL) -> URL? {
guard let urlString = url.absoluteString.data(using: .utf8) else {
Expand All @@ -209,7 +209,7 @@ extension SpecialErrorPageTabExtension: SpecialErrorPageUserScriptDelegate {
func visitSite() {
if errorPageType == .phishing {
if let url = webView?.url {
//PixelKit.fire(PhishingDetectionPixels.visitSite)
// PixelKit.fire(PhishingDetectionPixels.visitSite)
phishingURLExemptions.insert(url)
self.phishingStateManager.didBypassError = true
self.phishingStateManager.isShowingPhishingError = false
Expand Down

0 comments on commit a9e3376

Please sign in to comment.