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

Conversation

Projects
None yet
5 participants
@rullzer
Copy link
Member

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 roeland@famdouma.nl

@nickvergessen
Copy link
Member

nickvergessen left a comment

🙈🐘

@bzdega

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

MorrisJobke commented Oct 11, 2018

i changed the jail.php like this:

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

@bzdega

This comment has been minimized.

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

This comment has been minimized.

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

Normalize getUnjailedPath
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 <roeland@famdouma.nl>

@rullzer rullzer force-pushed the fix/11637/sharedstorageroot branch from 8077a27 to 51e96dc Oct 11, 2018

@rullzer rullzer added 4. to release and removed 3. to review labels Oct 11, 2018

@bzdega

This comment has been minimized.

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

1 check failed

continuous-integration/drone/pr the build failed
Details

@rullzer rullzer deleted the fix/11637/sharedstorageroot branch Oct 11, 2018

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