Skip to content
Merged
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
Binary file modified dist/addon.node
Binary file not shown.
1 change: 1 addition & 0 deletions include/sync_root_interface/SyncRoot.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SyncRoot
static HRESULT ConnectSyncRoot(const wchar_t *syncRootPath, InputSyncCallbacks syncCallbacks, napi_env env, CF_CONNECTION_KEY *connectionKey);
static HRESULT DisconnectSyncRoot(const wchar_t *syncRootPath);
static HRESULT UnregisterSyncRoot(const GUID &providerId);
static HRESULT UnregisterSyncRoot(const wchar_t *providerIdStr);
static std::string GetFileIdentity(const wchar_t *path);
static void HydrateFile(const wchar_t *filePath);
static void DehydrateFile(const wchar_t *filePath);
Expand Down
15 changes: 15 additions & 0 deletions native-src/sync_root_interface/SyncRoot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ HRESULT SyncRoot::UnregisterSyncRoot(const GUID &providerId)
}
}

HRESULT SyncRoot::UnregisterSyncRoot(const wchar_t *providerIdStr)
{
try
{
Logger::getInstance().log("Unregistering sync root (string).", LogLevel::INFO);
winrt::StorageProviderSyncRootManager::Unregister(providerIdStr);
return S_OK;
}
catch (...)
{
wprintf(L"Could not unregister the sync root (string), hr %08x\n", static_cast<HRESULT>(winrt::to_hresult()));
return E_FAIL;
}
}

HRESULT SyncRoot::ConnectSyncRoot(const wchar_t *syncRootPath, InputSyncCallbacks syncCallbacks, napi_env env, CF_CONNECTION_KEY *connectionKey)
{
try
Expand Down
25 changes: 21 additions & 4 deletions native-src/virtual_drive/Wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ napi_value CreatePlaceholderFile(napi_env env, napi_callback_info args)
return resultObj;
}

/**
* v2.5.7 Carlos Gonzalez
* Added backward compatibility for the default virtual drive identifier "syncRootID".
* If the provided ID is "syncRootID", it will be unregistered without throwing an error,
* maintaining support for previous versions that used it instead of a GUID.
*/

napi_value UnregisterSyncRootWrapper(napi_env env, napi_callback_info args)
{
size_t argc = 1;
Expand All @@ -147,15 +154,25 @@ napi_value UnregisterSyncRootWrapper(napi_env env, napi_callback_info args)
providerIdStr = new WCHAR[providerIdStrLength + 1];
napi_get_value_string_utf16(env, argv[0], reinterpret_cast<char16_t *>(const_cast<wchar_t *>(providerIdStr)), providerIdStrLength + 1, nullptr);

if (FAILED(CLSIDFromString(providerIdStr, &providerId)))

HRESULT result;
HRESULT guidResult = CLSIDFromString(providerIdStr, &providerId);

if (SUCCEEDED(guidResult))
{
napi_throw_error(env, nullptr, "Invalid GUID format");
result = SyncRoot::UnregisterSyncRoot(providerId);
}
else if (wcscmp(providerIdStr, L"syncRootID") == 0)
{
result = SyncRoot::UnregisterSyncRoot(providerIdStr);
}
else
{
napi_throw_error(env, nullptr, "Invalid provider ID: must be a GUID or 'syncRootID'");
delete[] providerIdStr;
return nullptr;
}

HRESULT result = SyncRoot::UnregisterSyncRoot(providerId);

delete[] providerIdStr;

napi_value napiResult;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/node-win",
"version": "1.0.21",
"version": "1.0.22",
"author": "Internxt <hello@internxt.com>",
"description": "Drive desktop node addon",
"main": "dist/index.js",
Expand Down