Issue Details (XML | Word | Printable)

Key: SRC-682
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Unassigned
Reporter: chandra sekhar
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Selenium Remote Control

attachFile not working.

Created: 11/Jun/09 06:28 AM   Updated: 01/Jul/10 10:20 PM
Return to search
Component/s: Server
Affects Version/s: 1.0.1
Fix Version/s: None

File Attachments: 1. File attachFile.diff (2 kB) 12/Jun/09 01:15 AM - chandra sekhar
2. Text File attachFile.patch (0.7 kB) 11/Jun/09 06:28 AM - chandra sekhar

Environment: Linux


 Description  « Hide

Description of issue:

Earlier, attachFile() used to create temp file with random name under /tmp. Right now, it is trying to create temp file under /tmp with the same name as the file being passed. If we pass /usr/local/google/my_upload_file to attachFile, it is trying to create temp file like: /tmp/usr/local/google/my_upload_file. This creation of temp file is failing because /tmp/usr/local/google directory doesnt exist.

To reproduce this issue:
selenium.open("/"); // assuming this url contains a form with field "name_of_files" of type 'file'.
selenium.attachFile("name_of_files", "file:///usr/local/selenium_failure10870.html");

Fix:
Fix for this issue is to create the parent dir if it doesnt exists. I am attaching patch which fixes this issues.



chandra sekhar added a comment - 12/Jun/09 01:15 AM

Earlier patch doesnt delete tmp dirs created. This sets deleteOnExit flag on the all intermediate directories that get created.


chandra sekhar made changes - 12/Jun/09 01:15 AM
Field Original Value New Value
Attachment attachFile.diff [ 11917 ]
Jennifer Bevan added a comment - 12/Jun/09 02:09 PM

slightly modified version of attachFile.diff submitted in rev 2697.

Instead of commenting out the outputFile.deleteOnExit() I'm just removing the line:

private File downloadFile(String urlString) {^M
URL url;^M
@@ -616,7 +630,7 @@
String fileName = url.getFile();^M
^M
File outputFile = createTempFile(fileName);^M

  • outputFile.deleteOnExit(); // to be on the safe side.^M
    + // outputFile.deleteOnExit(); // to be on the safe side.^M
    ^M
    downloadWithAnt(url, outputFile);^M
    ^M

to

private File downloadFile(String urlString) {^M
URL url;^M
@@ -616,7 +630,7 @@
String fileName = url.getFile();^M
^M
File outputFile = createTempFile(fileName);^M

  • outputFile.deleteOnExit(); // to be on the safe side.^M
    ^M
    downloadWithAnt(url, outputFile);^M
    ^M

Andras Hatvani made changes - 30/Jun/09 01:31 PM
Comment [ Jennifer, since you committed a patch please also update the issue accordingly. Furthermore, please catch up the the missing unit tests. ]
Andras Hatvani added a comment - 30/Jun/09 01:32 PM

Jennifer, since you committed a patch please also update the issue accordingly: assign to yourself and resolve/close. Furthermore, please catch up the the missing unit tests.


Dominic Clifton added a comment - 01/Jul/10 07:46 AM

I just stumbled into this bug today too. Any idea if this will be sorted in time for the next release?


Tarun added a comment - 01/Jul/10 10:20 PM

I was under assumption that we have stopped using JIRA.
If so then can somebody please block write access to JIRA?