Skip to content

Use canonical path for file input value#32

Closed
robertfausk wants to merge 1 commit into
minkphp:masterfrom
robertfausk:patch-2
Closed

Use canonical path for file input value#32
robertfausk wants to merge 1 commit into
minkphp:masterfrom
robertfausk:patch-2

Conversation

@robertfausk

Copy link
Copy Markdown
Contributor

Also see #26 and #9

Executing the test suite with panther gives following result:

There was 1 error:

1) Behat\Mink\Tests\Driver\Custom\Js\ChangeEventTest::testSetValueChangeEvent with data set "file" ('the-file', '/var/www/html/vendor/mink/dri...e1.txt', '/var/www/html/vendor/mink/dri...e2.txt')
Facebook\WebDriver\Exception\UnknownServerException: unknown error: path is not canonical: /var/www/html/vendor/mink/driver-testsuite/tests/Js/../../web-fixtures/file1.txt

@robertfausk

Copy link
Copy Markdown
Contributor Author

Otherwise this could also be handled in specific driver implementation to be more fail save.

E.g. something like:

    public function setValue($xpath, $value)
    {
        // ...

        // add workaround for now in case value is not a canonical path
        if ('input' === $element->getTagName() && 'file' === $element->getAttribute('type')) {
            $realpathValue = \realpath($value);
            $value = \is_string($realpathValue) ? $realpathValue : $value;
        }

		// ...
	}

@stof @aik099 What do you think?

@stof

stof commented Mar 26, 2019

Copy link
Copy Markdown
Member

IMO, we should not force users to provide a canonical path. If a driver has this requirement internally, it should perform the canonicalization.

@robertfausk

Copy link
Copy Markdown
Contributor Author

Alright. I'm fine with this. Closing then:)

@robertfausk robertfausk deleted the patch-2 branch March 30, 2019 07:36
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