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

Wrong signature when there is no commands #16

Merged
merged 3 commits into from
Dec 12, 2014
Merged

Wrong signature when there is no commands #16

merged 3 commits into from
Dec 12, 2014

Conversation

xkobal
Copy link
Contributor

@xkobal xkobal commented Dec 12, 2014

The signature is wrong when we try to create an URL without any commands, for proxying reasons for example:

$thumbnailUrlFactory = Thumbor\Url\BuilderFactory::construct('https://DOMAINE', $secret);

echo $thumbnailUrlFactory
->url('http://images.example.com/llamas.jpg')
->build()
->toString();

Result in:
https://DOMAINE/w_ENl4PO7AIjS4x33fmoAQDI-kQ=//http://images.example.com/llamas.jpg

which is wrong and must be:

https://DOMAINE/I5ejYVaMsVMGWaxaVKrgSw3UoP0=/http://images.example.com/llamas.jpg

@@ -37,15 +37,23 @@ public function __construct($server, $secret, $original, $commands)
*/
public function stringify($server, $secret, $original, $commands)
{
$commandPath = implode('/', $commands);
$signature = $secret ? self::sign("$commandPath/$original", $secret) : 'unsafe';
if(count($commands) > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you reformat this as PSR-2?

@harto
Copy link
Contributor

harto commented Dec 12, 2014

Thanks! Could you please add a test case? :-)

@xkobal
Copy link
Contributor Author

xkobal commented Dec 12, 2014

Done ;-) (Change test case)

@harto
Copy link
Contributor

harto commented Dec 12, 2014

Thanks very much! :-)

harto added a commit that referenced this pull request Dec 12, 2014
Wrong signature when there is no commands
@harto harto merged commit 99890bb into 99designs:master Dec 12, 2014
@harto
Copy link
Contributor

harto commented Dec 12, 2014

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.

2 participants