Skip to content

Commit 5751c21

Browse files
authored
Merge pull request #10606 from nextcloud/backport/10599/stable-34.0
[stable-34.0] fix(macOS): compare FinderSync broker application versions
2 parents fa2ba69 + 63462f9 commit 5751c21

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

shell_integration/MacOSX/NextcloudIntegration/FinderSyncBroker/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private func readBundleIdentity() -> BundleIdentity? {
5151
return BundleIdentity(serviceName: serviceName,
5252
teamIdentifier: team,
5353
applicationRevDomain: revDomain,
54-
version: info["CFBundleVersion"] as? String ?? "0")
54+
version: info["CFBundleShortVersionString"] as? String ?? "")
5555
}
5656

5757
/// Prove the listener is actually reachable, rather than assuming it is.

shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/Services/FinderSyncBrokerProtocol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ NS_ASSUME_NONNULL_BEGIN
8080
* unregister completion handler before re-registering, because registering too early
8181
* fails with SMAppServiceErrorDomain code 1.
8282
*
83-
* @param reply Invoked with the broker's CFBundleVersion.
83+
* @param reply Invoked with the broker's CFBundleShortVersionString.
8484
*/
8585
- (void)brokerVersionWithReply:(void(^)(NSString *version))reply;
8686

src/gui/macOS/findersyncxpc_mac.mm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
#include "findersyncxpc.h"
7+
#include "version.h"
78

89
#import <Foundation/Foundation.h>
910
#import "../../../shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/Services/FinderSyncProtocol.h"
@@ -332,11 +333,7 @@ - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConne
332333
// and we would go on talking to last version's broker indefinitely.
333334
[broker brokerVersionWithReply:^(NSString *version) {
334335
const auto brokerVersion = QString::fromNSString(version);
335-
// Deliberately the literal key rather than kCFBundleVersionKey: that constant would add
336-
// a CoreFoundation data symbol to this translation unit for no benefit, and the other
337-
// Info.plist reads here use literals too.
338-
const auto ourVersion = QString::fromNSString(
339-
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]);
336+
const auto ourVersion = QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION));
340337

341338
if (brokerVersion == ourVersion) {
342339
qCDebug(lcFinderSyncXPC) << "Broker version matches ours:" << brokerVersion;

0 commit comments

Comments
 (0)