Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Fix double directory separator at the end of root. #4

Closed
wants to merge 1 commit into from
Closed

Fix double directory separator at the end of root. #4

wants to merge 1 commit into from

Conversation

Metalaka
Copy link
Member

PR for #3.

@Hywan
Copy link
Member

Hywan commented May 28, 2014

Hello :-),

Are we sure that the resolve function will add a DS (if this is a directory)? I don't think so… maybe you could rtrim / and \, and append DS.

@Hywan Hywan self-assigned this May 28, 2014
@Metalaka
Copy link
Member Author

The return value of resolve is strange, or at least not fully normalized for hoa://Application*.

So if it's not normal, we must close this PR and open another into Hoa\Core to normalize resolve.

Tests

Hoa protocol (local):

$ php Hoa.php Core:resolve hoa://Application/Public
hoa://Application/Public is equivalent to:
/var/www/hoa-learn/Application/Public/
$ php Hoa.php Core:resolve hoa://Application/Public/
hoa://Application/Public/ is equivalent to:
/var/www/hoa-learn/Application/Public/
$ php Hoa.php Core:resolve hoa://Application/Public///
hoa://Application/Public/// is equivalent to:
/var/www/hoa-learn/Application/Public/

$ php Hoa.php Core:resolve hoa://Data/Bin
hoa://Data/Bin is equivalent to:
/var/www/hoa-learn/Data/Bin
$ php Hoa.php Core:resolve hoa://Data/Bin/
hoa://Data/Bin/ is equivalent to:
/var/www/hoa-learn/Data/Bin

$ php Hoa.php Core:resolve -E hoa://Application/FakeDir/
hoa://Application/FakeDir/ is equivalent to:
/var/www/hoa-learn/Application/FakeDir

Hoa protocol (global):

$ php Hoa.php Core:resolve hoa://Library/Core
hoa://Library/Core is equivalent to:
/usr/local/lib/Hoa/Core
$ php Hoa.php Core:resolve hoa://Library/Core/
hoa://Library/Core/ is equivalent to:
/usr/local/lib/Hoa/Core

File system:

$ php Hoa.php Core:resolve /var/www/hoa-learn/
/var/www/hoa-learn/ is equivalent to:
/var/www/hoa-learn/
$ php Hoa.php Core:resolve /var/www/hoa-learn
/var/www/hoa-learn is equivalent to:
/var/www/hoa-learn

@Hywan
Copy link
Member

Hywan commented Jun 17, 2014

So, first, are we agree that a trailing slash must be added if this is a directory? This is for security reason.

@Hywan
Copy link
Member

Hywan commented Jul 9, 2014

ping

@Metalaka
Copy link
Member Author

Metalaka commented Jul 9, 2014

If we say "must be added if this is a directory", so in a first time resolve must return a trailing slash if this is a directory?

@Metalaka
Copy link
Member Author

/ping @Hywan

At my mind it's better to normalize resolve,
maybe do that while optimizing Hoa with PHP 5.4 ?

@Hywan
Copy link
Member

Hywan commented Aug 24, 2014

Yes we have to normalize this. So yes, if it is a directory, we have to add a trailing slash. This is why we do in Hoa. What is the next step?

@Metalaka
Copy link
Member Author

@Hywan
Copy link
Member

Hywan commented Aug 27, 2014

What need to be patched?

@Hywan
Copy link
Member

Hywan commented Aug 27, 2014

(ahhh, I am lost with all these PR :-p).

@Metalaka
Copy link
Member Author

resolve must return a path with a trailing DS only when it's a directory.

@Metalaka
Copy link
Member Author

Bhoa removed in 9dc6217 ?

@Hywan
Copy link
Member

Hywan commented Jul 15, 2015

@Metalaka Yup, useless since PHP has its own build-in HTTP server.

@Metalaka
Copy link
Member Author

Useless yes, but cool :D

@Metalaka Metalaka closed this Jul 15, 2015
@Hywan Hywan removed the in progress label Jul 15, 2015
@Metalaka Metalaka deleted the patch-2 branch July 15, 2015 17:02
@Hywan
Copy link
Member

Hywan commented Jul 16, 2015

Sorry, didn't check the conflict with your PR :-(!

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

Successfully merging this pull request may close these issues.

None yet

2 participants