Skip to content
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

url encode the webdav URL in the graph API #3597

Merged
merged 1 commit into from
Apr 27, 2022
Merged

Conversation

C0rby
Copy link
Contributor

@C0rby C0rby commented Apr 27, 2022

Description

URL encode the webdav URL in the drives responses.

Related Issue

Motivation and Context

When a file name contains spaces the resulting URL would contain spaces and subsequent requests could fail because of that.

How Has This Been Tested?

  • test environment: locally
  • Via the graph-explorer

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • Code changes

@C0rby C0rby requested review from butonic and micbar April 27, 2022 10:42
@C0rby C0rby self-assigned this Apr 27, 2022
Comment on lines +248 to +250
webdavURL := *baseURL
webdavURL.Path = path.Join(webdavURL.Path, space.Id.OpaqueId, itemPath)
spaceItem.WebDavUrl = libregraph.PtrString(webdavURL.String())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the relevant change. Everything else is just some clean up. We really shouldn't use pointers everywhere.

@sonarcloud
Copy link

sonarcloud bot commented Apr 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@rhafer rhafer left a comment

Choose a reason for hiding this comment

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

lgtm 👍

@C0rby C0rby merged commit 0a18c25 into master Apr 27, 2022
@delete-merged-branch delete-merged-branch bot deleted the urlencoding-graph-api branch April 27, 2022 11:22
ownclouders pushed a commit that referenced this pull request Apr 27, 2022
Merge: 0758854 4bb4f9f
Author: David Christofas <dchristofas@owncloud.com>
Date:   Wed Apr 27 13:21:56 2022 +0200

    Merge pull request #3597 from owncloud/urlencoding-graph-api

    url encode the webdav URL in the graph API
@micbar micbar mentioned this pull request May 5, 2022
45 tasks
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.

Unescaped URLs in drives API JSON
2 participants