View Issue Details

IDProjectCategoryView StatusLast Update
0012299Talerwallet (iOS App)public2026-11-22 14:40
Reporterbot-cg [agent]  
PrioritynormalSeverityminor 
Status new 
Summary0012299: Paste (Actions sheet) is disabled for the link the wallet's own Copy/Share produce: two lines of text, or image + text, are not a URL to the pasteboard (patch attached)
DescriptionA payment link copied with the wallet's own "Copy" button cannot be pasted
into the wallet with the "Paste" button of the Actions sheet. The same holds
for the text the wallet shares: someone who receives it in a chat, copies the
message and presses Paste in their wallet gets a disabled button.

What "Copy" and "Share" produce
-------------------------------
QRCodeDetailView.talerCopyShare (QRCodeDetailView.swift:64-67) is two lines of
text:

    taler://pay-push/exchange.demo.taler.net/A6TN...
    https://wallet.taler.net/link#pay-push/exchange.demo.taler.net/A6TN...

and CopyShare.copyAction() (CopyShare.swift:100-113), when it has the QR
image, writes two pasteboard items: [image, that text].

What "Paste" accepts
--------------------
 * GNU_Taler / Taler_Wallet: the button is enabled only if
   UIPasteboard.general.hasURLs (ActionsSheet.swift:171), and
   inspectPasteboard() returns at once without it
   (TalerWallet1App.swift:65).
 * Taler_Nightly: PasteButton(supportedContentTypes: [.url])
   (ActionsSheet.swift:149).

Neither of the two things above is a URL to UIKit. Asked directly (a small
probe run inside the iOS 27.2 simulator with simctl spawn):

    pasteboard content hasURLs public.url
    one line "taler://pay-push/..." true yes
    one line "https://wallet.taler.net/link#.." true yes
    two lines, taler:// then https:// false no
    items [image, two lines of text] false no

For the last one `pasteboard.string` is nil as well (it is the first item's
string), so reading the text needs `pasteboard.strings`.

Two more things in the same code, found by reading, not run separately:
 * String.toURL makes ONE url of the two lines (the line break becomes %0A),
   so text that did get past the gate would be sent on with the https line
   glued to the key.
 * A pasted https://wallet.taler.net/link#... line alone passes the gate and
   is then dropped, because only the scheme "taler" is posted
   (TalerWallet1App.swift:83-87, ActionsSheet.swift:154-156) -- although
   Controller.openURL handles that https form.

Observed (iPhone 17 simulator, iOS 27.2, 2026-11-22)
----------------------------------------------------
Wallet funded with 25 KUDOS; Actions > Send > 5 KUDOS > "Send KUDOS 5.00 now";
on the "Send Money" page press "Copy"; Done; Actions; press Paste.

    build Paste button after pressing it
    GNU_Taler, unpatched disabled nothing
    Taler_Nightly, unpatched looks disabled nothing
    GNU_Taler, with the patch enabled "Receive" sheet for the link
    Taler_Nightly, with the patch enabled "Receive" sheet for the link

One run per row, plus a second run of the patched GNU_Taler build with log
lines added, which showed the path: hasURLs=false hasStrings=true items=2,
pattern found in the second item, link read, "saveURL: payPush". See
paste-copied-link.jpg (left: unpatched GNU_Taler; right: with the patch).

Line numbers are those of master 16f6f629. The builds are the fuzzing
branch: that master plus patches attached to other issues, none of which
changes what is copied or how Paste works (in CopyShare.swift it only adds
accessibility identifiers).

Patch
-----
paste-copied-link-v16f6f629.diff, against master 16f6f629 (3 files, +43 -20):
 * String.firstTalerLink: the first taler:// link in a piece of text, else
   the first https://wallet.taler.net/link... one;
 * inspectPasteboard() goes on when the pasteboard has strings, reads
   `pasteboard.strings`, and posts firstTalerLink;
 * the GNU_Taler button is enabled on hasURLs || hasStrings;
 * the nightly PasteButton takes [.url, .plainText] and uses firstTalerLink.
It applies to master and was built and run as described above (the test
builds carried a few extra log lines, which are not in the patch).

Not tested: the receiving side with text copied from another app. There iOS
shows its own "Allow Paste" question for the GNU_Taler flavour, as it does
today for a single-line link.

Possibly related: 0009862 (copy+paste of a payto URI).

Found with the UI fuzz harness, scenario paste-button-works-default.

Estimated severity: minor -- the links themselves still work when tapped; it
is the Paste button that does not accept the wallet's own format.

Filed by an agent (bot-cg) on behalf of Christian Grothoff, from an automated
UI exploration campaign.
TagsNo tags attached.
Attached Files
paste-copied-link.jpg (83,998 bytes)   
paste-copied-link.jpg (83,998 bytes)   
paste-copied-link-v16f6f629.diff (6,883 bytes)   
diff --git a/TalerCommon/Helper/TalerStrings.swift b/TalerCommon/Helper/TalerStrings.swift
index bb2f0692..437524ac 100644
--- a/TalerCommon/Helper/TalerStrings.swift
+++ b/TalerCommon/Helper/TalerStrings.swift
@@ -71,6 +71,26 @@ extension String {
         return nil
     }
 
+    /// The first Taler link in a piece of pasted text.
+    ///
+    /// What this wallet puts on the pasteboard and into the share sheet is two lines -- the
+    /// `taler://` link and its `https://wallet.taler.net/link#` form -- and text copied from a
+    /// chat can have more around them.  `toURL` makes ONE url of all of it (the line break
+    /// becomes %0A), which is no link at all.
+    public var firstTalerLink: URL? {
+        var webLink: URL? = nil
+        for part in self.components(separatedBy: .whitespacesAndNewlines) where !part.isEmpty {
+            guard let url = URL(string: part), let scheme = url.scheme?.lowercased() else { continue }
+            if scheme == "taler" {
+                return url
+            }
+            if webLink == nil, scheme == "https", url.host == "wallet.taler.net", url.path.hasPrefix("/link") {
+                webLink = url
+            }
+        }
+        return webLink
+    }
+
     func deletingPrefix(_ prefix: String) -> String {
         guard self.hasPrefix(prefix) else { return self }
         return String(self.dropFirst(prefix.count))
diff --git a/TalerWallet1/Controllers/TalerWallet1App.swift b/TalerWallet1/Controllers/TalerWallet1App.swift
index 77bc69b6..a62d1e17 100644
--- a/TalerWallet1/Controllers/TalerWallet1App.swift
+++ b/TalerWallet1/Controllers/TalerWallet1App.swift
@@ -61,8 +61,11 @@ struct TalerWallet1App: App {
 
     func inspectPasteboard(playSound: Bool) {
         let pasteboard = UIPasteboard.general
-        // We are only interested in URLs
-        if !pasteboard.hasURLs { return }
+        // We are only interested in links -- but a link copied as text is not always a URL to
+        // the pasteboard: two lines of text, which is what our own Copy and Share produce
+        // (taler:// and the https form), have no public.url representation, and neither has
+        // the [QR image, text] pair that Copy writes.
+        if !pasteboard.hasURLs && !pasteboard.hasStrings { return }
 
         // users get asked whether they want to paste, and only if they agree we go to completion
         pasteboard.detectPatterns(for: [UIPasteboard.DetectionPattern.probableWebURL],
@@ -76,17 +79,18 @@ struct TalerWallet1App: App {
 
                     if detectedPatterns.contains([UIPasteboard.DetectionPattern.probableWebURL]) {
                         // Will match if the pasteboard string has a URL within it
-                        self.pastedWebURL = pasteboard.string
-                        if let string = pasteboard.string {
+                        // every item, not only the first: Copy puts the QR image first,
+                        // and `pasteboard.string` is the first item's string, i.e. nil
+                        let strings = pasteboard.strings ?? []
+                        let string: String? = strings.isEmpty ? nil : strings.joined(separator: LINEFEED)
+                        self.pastedWebURL = string
+                        if let string {
                             if self.pastedString != string {
                                 self.pastedString = string
-                                if let pastedURL = string.toURL {
-                                    let scheme = pastedURL.scheme
-                                    if scheme?.lowercased() == "taler" {
-//                                        print(string)
-                                        post(pastedURL)
-                                        return
-                                    }
+                                if let pastedURL = string.firstTalerLink {
+//                                    print(string)
+                                    post(pastedURL)
+                                    return
                                 }
                             }
                         }
diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift
index d91e7e16..d5caac95 100755
--- a/TalerWallet1/Views/Actions/ActionsSheet.swift
+++ b/TalerWallet1/Views/Actions/ActionsSheet.swift
@@ -146,18 +146,17 @@ struct ActionsSheet: View {
                 if #available(iOS 26.0, *) {
                     if !pasteAutomatically {
 #if TALER_NIGHTLY
-                        PasteButton(supportedContentTypes: [.url]) { providers in
+                        // .plainText as well: the two lines our own Copy and Share produce are
+                        // text without a URL representation, and the button stayed disabled
+                        PasteButton(supportedContentTypes: [.url, .plainText]) { providers in
                             for provider in providers {
                                 if provider.canLoadObject(ofClass: String.self) {
                                     _ = provider.loadObject(ofClass: String.self) { string, error in
                                         guard let string else { return }
-                                        if let pastedURL = string.toURL {
-                                            let scheme = pastedURL.scheme
-                                            if scheme?.lowercased() == "taler" {
-                                                let pasteType = PasteType(pastedURL: pastedURL)
-                                                let userinfo = [NOTIFICATIONPASTE: pasteType]
-                                                NotificationCenter.default.post(name: .PasteAction, object: nil, userInfo: userinfo)
-                                            }
+                                        if let pastedURL = string.firstTalerLink {
+                                            let pasteType = PasteType(pastedURL: pastedURL)
+                                            let userinfo = [NOTIFICATIONPASTE: pasteType]
+                                            NotificationCenter.default.post(name: .PasteAction, object: nil, userInfo: userinfo)
                                         }
                                     }
                                 }
@@ -168,7 +167,7 @@ struct ActionsSheet: View {
                         .buttonBorderShape(.circle) // capsule
                         .accessibility(sortPriority: 1)
 #else
-                        let isEnabled = UIPasteboard.general.hasURLs
+                        let isEnabled = UIPasteboard.general.hasURLs || UIPasteboard.general.hasStrings
                         TalerPasteButton(accessibilityLabelStr: "Paste") {
                             Task {
                                 TalerWallet1App().inspectPasteboard(playSound: true)

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-22 14:40bot-cgNew Issue
2026-11-22 14:40bot-cgImplementer => MarcS
2026-11-22 14:40bot-cgReviewer => vlada.svirsh
2026-11-22 14:40bot-cgRelease signed by => MarcS
2026-11-22 14:40bot-cgDeployed by => MarcS
2026-11-22 14:40bot-cgVerifier => vlada.svirsh
2026-11-22 14:40bot-cgCommunicator => CM_7
2026-11-22 14:40bot-cgFile Added: paste-copied-link.jpg
2026-11-22 14:40bot-cgFile Added: paste-copied-link-v16f6f629.diff