Skip to content

Latest commit

 

History

History
164 lines (131 loc) · 6.66 KB

File metadata and controls

164 lines (131 loc) · 6.66 KB

Windows Globus Endpoint Fix - Implementation Summary

Status: ✅ IMPLEMENTED AND COMPILED

Date: January 13, 2026
File Modified: rdm-integration/image/app/plugin/impl/globus/common.go

What Was Changed

Added Functions

1. isDriveLetter(name string) bool

  • Checks if a string is a single letter (A-Z or a-z)
  • Used to identify Windows drive letters
  • Returns false for multi-character names like "Users", "home", etc.

2. isWindowsDriveEnvironment(entries []Data) bool

  • Detects if we're on a Windows endpoint by examining the root directory listing
  • Detection Strategy:
    • Looks for drive letters (C, D, E, etc.) - counts occurrences
    • Looks for Windows system folders (Windows, Users, Program Files, ProgramData) - case-insensitive
    • Returns true if: driveLetters >= 2 OR windowsIndicators > 0
  • Why this works:
    • Windows with C, D, E drives → driveLetters = 3 → TRUE ✅
    • Windows with Users, Program Files → windowsIndicators = 2 → TRUE ✅
    • Linux with single "C" folder → No Windows indicators, only 1 drive letter → FALSE ✅
    • Linux normal → No indicators → FALSE ✅

Modified Function

listItems() - Added platform detection and smart path construction

  • New Logic:

    isWindows := false
    if path == "/" {
        isWindows = isWindowsDriveEnvironment(response)
    }
    • Only detects Windows at root level (path == "/")
    • Subsequent calls with non-root paths skip detection (already determined)
  • Smart Path Construction:

    if isWindows && v.AbsolutePath == "/" && isDriveLetter(v.Name) {
        id = v.Name + ":/"          // Windows: "C" → "C:/"
    } else {
        id = v.AbsolutePath + v.Name + "/"  // All others unchanged
    }
    • Windows drive roots at root: CC:/
    • Everything else: concatenate normally (Linux: /home//home/user/)
    • Nested Linux folders named "C" are handled correctly: /home/alice/C/ stays as /home/alice/C/

Why This Works

Windows GCP Personal Endpoint

  • API returns drives as folders: {Name: "C", AbsolutePath: "/"}
  • Detection: Sees multiple drives (C, D, E) OR Windows folders → isWindows = true
  • Construction: "C" → "C:/"
  • Result: User can browse C:/Users/, C:/Program Files/, etc.

Linux GCP Personal Endpoint

  • API returns normal folders: {Name: "home", AbsolutePath: "/"}
  • Detection: No drive letters (only "home", "usr", "var"), no Windows folders → isWindows = false
  • Construction: Normal concatenation → /home/
  • Result: No change in behavior, backward compatible

Linux with Folder Named "C"

  • API returns: {Name: "C", AbsolutePath: "/"}, {Name: "home", AbsolutePath: "/"}
  • Detection: Single drive letter + no Windows indicators → isWindows = false
  • Construction: Normal concatenation → /C/
  • Result: User can still access /C/some/folder/

Server Endpoints

  • Work the same as GCP endpoints based on their actual filesystem structure
  • No special handling needed

Verification

Compilation Status

$ cd /home/eryk/projects/rdm-integration/image && go build ./app/plugin/impl/globus/...
# No errors - code compiles successfully

Testing Needed

Unit Tests (TODO)

  • TestIsWindowsDriveEnvironment() - Windows, Linux, edge cases
  • TestIsDriveLetter() - Single letters, multi-char, case variations
  • TestListItemsPathConstruction() - Windows paths, Linux paths, nested paths

Integration Tests (TODO)

  • Windows GCP Personal - Browse root, expand drives, navigate folders
  • Linux GCP Personal - Verify no regression
  • macOS GCP Personal - Verify no regression
  • Linux with "C" folder - Verify it's accessible
  • Server endpoints - Verify no regression

Manual Testing Checklist

  • Windows personal endpoint - browse from root
  • Windows personal endpoint - select Documents folder
  • Windows personal endpoint - select and transfer files
  • Linux endpoint - verify all paths work
  • macOS endpoint - verify all paths work
  • Endpoint with custom DefaultDirectory - verify it's accessible

Files Modified

  1. rdm-integration/image/app/plugin/impl/globus/common.go

    • Added: isDriveLetter() function (18 lines)
    • Added: isWindowsDriveEnvironment() function (50 lines)
    • Modified: listItems() function (added 8 lines of logic, 0 lines removed)
    • Total change: ~76 lines added, minimal complexity
  2. rdm-integration-frontend/globus_endpoint_windows.md

    • Updated documentation with implementation status
    • Updated success criteria
    • Updated implementation plan with completed/pending items

Key Design Decisions

  1. Platform detection at root only: Avoids repeated detection calls and improves performance
  2. Dual detection strategy: Checks for both drive letters AND Windows system folders for robustness
  3. Conservative threshold: Requires 2+ drive letters OR any Windows system folder to detect Windows
    • Prevents false positives (single "C" folder on Linux)
  4. No configuration: Fully automatic - detects platform from available data
  5. No frontend changes: Backend-only fix, frontend receives correct paths

Risk Assessment

Low Risk ✅

  • Changes are isolated to path construction logic
  • All other functionality unchanged
  • No database, API, or frontend modifications
  • Backward compatible with all endpoint types
  • Compilation verified

Edge Cases Handled ✅

  • Single-letter folder on Linux: Safe (requires Windows indicators)
  • Case variations (C vs c): Handled by case-insensitive comparison
  • Mapped network drives: Work as drive letters
  • Nested paths: Drive detection only at root

Potential Issues and Mitigation

Issue Likelihood Mitigation
Linux with only "C" folder Very Low Rare OS configuration
Globus API changes Low Detection still works with existing API format
Performance overhead Very Low Detection only at root, minimal calculations

Next Steps

  1. Run unit tests on the new functions (or create them)
  2. Integration test with real Windows endpoint - highest priority
  3. Regression test on Linux/macOS endpoints
  4. Deploy to staging for user testing
  5. Document change in release notes

References