Skip to content

Commit 12c704b

Browse files
Merge pull request #84 from InteractionEngineer/bugfix/nextcloud-subpath
fixed Cospend URL decoding for subdirectory Nextcloud instances, fixes #82
2 parents e1f464d + af70d14 commit 12c704b

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

PayForMe.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@
804804
"$(inherited)",
805805
"@executable_path/Frameworks",
806806
);
807-
MARKETING_VERSION = 2.5;
807+
MARKETING_VERSION = 2.5.1;
808808
PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe;
809809
PRODUCT_NAME = PayForMe;
810810
SWIFT_VERSION = 5.0;
@@ -829,7 +829,7 @@
829829
"$(inherited)",
830830
"@executable_path/Frameworks",
831831
);
832-
MARKETING_VERSION = 2.5;
832+
MARKETING_VERSION = 2.5.1;
833833
PRODUCT_BUNDLE_IDENTIFIER = de.mayflower.PayForMe;
834834
PRODUCT_NAME = PayForMe;
835835
SWIFT_VERSION = 5.0;

PayForMe.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PayForMe/Util/Util.swift

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,22 @@ extension URL {
190190
func decodeCospendString() -> ProjectData {
191191
guard let host = host,
192192
let scheme = scheme,
193-
scheme.localizedCaseInsensitiveContains("cospend"),
194-
pathComponents.count >= 2,
195-
pathComponents.count <= 3
193+
scheme.localizedCaseInsensitiveContains("cospend")
196194
else {
197195
return (nil, nil, nil)
198196
}
199-
return (URL(string: "https://\(host)" + ((port != nil) ? ":\(port!)" : "")),
200-
pathComponents[1],
201-
pathComponents[safe: 2])
197+
198+
var hostString = "https://\(host)"
199+
200+
if let port = port {hostString += ":\(port)"}
201+
202+
if pathComponents.count > 3 {
203+
hostString += "/" + pathComponents[1..<(pathComponents.count - 2)].joined(separator: "/")
204+
}
205+
206+
return (URL(string: hostString),
207+
pathComponents[safe: pathComponents.count - 2],
208+
pathComponents.last)
202209
}
203210
}
204211

0 commit comments

Comments
 (0)