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

Do not pass '.' along as path #11764

Merged
merged 1 commit into from
Oct 11, 2018
Merged

Do not pass '.' along as path #11764

merged 1 commit into from
Oct 11, 2018

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Oct 11, 2018

Fixes #11637

When writing a file to the root of a shared storage we have to obtain
creatable information on the root of the share. However getting the
dirname of the path then results in .. Passing this along potentially
breaks.

For example objectstores do not have the same hierachy as a normal fs.
So the file . doesn't mean anything in that context.

Signed-off-by: Roeland Jago Douma [email protected]

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

🙈🐘

@bzdega
Copy link

bzdega commented Oct 11, 2018

i changed the jail.php like this:

	public function getUnjailedPath($path) {
		if ($path === '') {
			return $this->rootPath;
		} else {
			return $this->rootPath . '/' . $path;
			return Filesystem::normalizePath($this->rootPath . '/' . $path);
		}
	}

but after reloading my Nextcloud-Page, the erros still occures.

@rullzer
Copy link
Member Author

rullzer commented Oct 11, 2018

Replace it with

	public function getUnjailedPath($path) {
		if ($path === '') {
			return $this->rootPath;
		} else {
			return Filesystem::normalizePath($this->rootPath . '/' . $path);
		}
	}

@MorrisJobke
Copy link
Member

i changed the jail.php like this:

Red lines in the git diff means "removed line" and green "added line".

@bzdega
Copy link

bzdega commented Oct 11, 2018

ok, changed the code.

Now, when uploading or creating a file, there is no more error message, but the file does not appear and the "upload-bar" stays saying "a few seconds".

grafik

@bzdega
Copy link

bzdega commented Oct 11, 2018

Stop, made a mistake: forgot to add use OC\Files\Filesystem;. After adding this line, it works!

You are great - thank you!

grafik

Fixes #11637

If we do not normalize the unjailed path we might end up with a path
like files/user/folder/. which can break on objectstores

Signed-off-by: Roeland Jago Douma <[email protected]>
@rullzer rullzer added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Oct 11, 2018
@bzdega
Copy link

bzdega commented Oct 11, 2018

Have made this fix in a second instance and it works likewise.

Perfect!

@rullzer rullzer merged commit 1fcb5db into master Oct 11, 2018
@rullzer rullzer deleted the fix/11637/sharedstorageroot branch October 11, 2018 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants