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

[5.4] Fixed duplicate // for public_path #19731

Merged
merged 2 commits into from
Jun 23, 2017
Merged

[5.4] Fixed duplicate // for public_path #19731

merged 2 commits into from
Jun 23, 2017

Conversation

brogier
Copy link

@brogier brogier commented Jun 22, 2017

I noticed a duplicate forward slash when using {{ mix('example.css', 'vendor/package/') }}

Turns out laravel mix adds a forward slash to 'vendor/package' and the public_path doen't check if the path starts with an slash.

@browner12
Copy link
Contributor

👍 this has been on my list of PRs to do, thanks for fixing it.

If I remember correctly, a lot (maybe all) of the other path helpers need this fix as well.

@taylorotwell
Copy link
Member

Why not just use ltrim

@ntzm
Copy link
Contributor

ntzm commented Jun 23, 2017

Agree with @taylorotwell, ltrim would work better and would also be easier to read than a nested ternary

@brogier
Copy link
Author

brogier commented Jun 23, 2017

Thanks for the feedback, changed it to ltrim.

@brogier brogier changed the title Fixed duplicate // for public_path [5.4] Fixed duplicate // for public_path Jun 23, 2017
@taylorotwell taylorotwell merged commit 8d54d7f into laravel:5.4 Jun 23, 2017
@taylorotwell
Copy link
Member

Thanks

@matancohen365
Copy link

Why not?

if( ! function_exists('path'))
{
	/** 
	 * @param string
	 * @return string
	 */
	function path($path = '')
	{
		return $path ? DIRECTORY_SEPARATOR . ltrim($path, DIRECTORY_SEPARATOR) : '';
	}
}

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.

5 participants