-
Notifications
You must be signed in to change notification settings - Fork 2k
feat: support SharePoint Teams URLs #5498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Someone is attempting to deploy a commit to the Danswer Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
This PR extends the SharePoint connector to support Microsoft Teams URLs (/teams/
) in addition to the existing SharePoint site collection URLs (/sites/
). The implementation is clean and maintains backward compatibility.
Key Changes:
- Updated URL validation to accept both
/sites/
and/teams/
patterns - Modified URL parsing logic to handle both site types with a unified approach
- Updated documentation strings and error messages to reflect the new capability
- No breaking changes to existing functionality
The changes are well-implemented with proper error handling, logging, and validation. The code follows existing patterns and maintains the same abstraction level throughout the connector.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- Score reflects well-structured code changes that extend functionality without breaking existing behavior. The implementation follows established patterns, includes proper validation and error handling, and maintains backward compatibility.
- No files require special attention
Important Files Changed
File Analysis
Filename | Score | Overview |
---|---|---|
backend/onyx/connectors/sharepoint/connector.py | 5/5 | Added support for Microsoft Teams SharePoint URLs (/teams/) alongside existing /sites/ URLs. Clean implementation with proper validation and error messages. |
Sequence Diagram
sequenceDiagram
participant User as User
participant Connector as SharepointConnector
participant Validator as validate_connector_settings
participant Extractor as _extract_site_and_drive_info
participant Logger as Logger
User->>Connector: Initialize with sites URLs
Note over User: URLs can be /sites/ or /teams/
Connector->>Validator: validate_connector_settings()
loop For each site URL
Validator->>Validator: Check if URL starts with "https://"
alt URL contains "/sites/" or "/teams/"
Validator->>Validator: Validation passes
else Invalid URL format
Validator->>User: Throw ConnectorValidationError
Note over Validator: "Site URLs must be full Sharepoint URLs..."
end
end
Connector->>Extractor: _extract_site_and_drive_info(sites)
loop For each URL
Extractor->>Extractor: Split URL by "/"
alt URL contains "sites"
Extractor->>Extractor: Find "sites" index
Extractor->>Extractor: Set site_type_index
else URL contains "teams"
Extractor->>Extractor: Find "teams" index
Extractor->>Extractor: Set site_type_index
else Neither sites nor teams
Extractor->>Logger: Log warning about invalid URL
Note over Logger: "Site URL is not valid (must contain /sites/ or /teams/)"
end
alt site_type_index is not None
Extractor->>Extractor: Extract base site URL (up to site/team name)
Extractor->>Extractor: Parse remaining parts for drive/folder
Extractor->>Extractor: Create SiteDescriptor object
end
end
Extractor->>Connector: Return list of SiteDescriptor objects
1 file reviewed, no comments
@wenxi-onyx Are there any concerns about this PR? |
Description
This commit adds support for Microsoft Teams SharePoint URLs (/teams/) in addition to the existing SharePoint site collection URLs (/sites/). Previously, the connector only worked with URLs like https://tenant.sharepoint.com/sites/sitename, but now it also supports https://gteu.sharepoint.com/teams/teamname.
How Has This Been Tested?
I tested the functionality manually by building the images locally and starting the application.
Additional Options
Summary by cubic
Adds support for SharePoint Teams URLs (/teams/) so the connector works with team sites as well as site collections. This enables URLs like https://tenant.sharepoint.com/teams/team-name to be validated and parsed correctly.