Skip to content

Conversation

@alexbourret
Copy link
Collaborator

@alexbourret alexbourret commented Nov 28, 2025

drive_name = None
if shared_directory_name.startswith("https://"):
base_64_sharing_url = base64.b64encode(shared_directory_name.encode("utf-8")).decode("utf-8")
base_64_sharing_url = base_64_sharing_url.replace("/", "_").replace("+", "-")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the doc https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=http#:~:text=encode%20the%20URL.-,Convert,-the%20base64%20encoded
Convert the base64 encoded result to unpadded base64url format by removing = characters from the end of the value, replacing / with _ and + with -.)

Suggested change
base_64_sharing_url = base_64_sharing_url.replace("/", "_").replace("+", "-")
base_64_sharing_url = base_64_sharing_url.rstrip("=").replace("/", "_").replace("+", "-")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants