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

Use canonical path for file input value #32

Closed
wants to merge 1 commit into from

Conversation

robertfausk
Copy link
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
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
Copy link
Member

stof commented Mar 26, 2019

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
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