Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer base64 encode customMetadata #3400

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ protocol UnifiedMetadataCollector {
}

protocol UnifiedFeedbackMetadata: Encodable {
func toBase64() -> String
func toString() -> String
}

extension UnifiedFeedbackMetadata {
func toBase64() -> String {
func toString() -> String {
let encoder = JSONEncoder()

do {
let encodedMetadata = try encoder.encode(self)
return encodedMetadata.base64EncodedString()
return String(data: encodedMetadata, encoding: .utf8) ?? ""
} catch {
return "Failed to encode metadata to JSON, error message: \(error.localizedDescription)"
return "Failed to encode metadata to JSON string, error message: \(error.localizedDescription)"
}
}
}
2 changes: 1 addition & 1 deletion DuckDuckGo/UnifiedFeedbackForm/UnifiedFeedbackSender.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct DefaultFeedbackSender: UnifiedFeedbackSender {
category: Category.from(category),
subcategory: Subcategory.from(subcategory),
description: description,
metadata: metadata?.toBase64() ?? ""))
metadata: metadata?.toString() ?? ""))
}

func sendFormShowPixel() {
Expand Down
Loading