Modify

Opened 5 years ago

Closed 4 years ago

#3836 closed Bug (Fixed)

FileExists with trailing quotation mark

Reported by: therks@… Owned by: Jon
Milestone: 3.3.15.5 Component: AutoIt
Version: 3.3.15.4 Severity: None
Keywords: FileExists Cc:

Description

Mentioned here first:
https://www.autoitscript.com/forum/topic/206186-fileexists-with-trailing-quote/

For some reason FileExists is treating paths that end with a quote mark (or multiple marks) as valid.

; Assuming File.txt exists:
ConsoleWrite(FileExists('File.txt'))   ; Returns 1
ConsoleWrite(FileExists('"File.txt"')) ; Returns 0
ConsoleWrite(FileExists('"File.txt'))  ; Returns 0
ConsoleWrite(FileExists('File.txt"'))  ; Returns 1
ConsoleWrite(FileExists('File.txt""')) ; Returns 1

Attachments (0)

Change History (4)

comment:1 by therks@…, 5 years ago

The following functions all behave similarly (ignoring the trailing quotation marks and returning valid results):
FileGetAttrib, FileGetLongName, FileGetShortName, FileGetSize, FileGetTime

FileGetVersion behaves expectedly, returning "0.0.0.0"

ConsoleWrite(FileExists(@AutoItExe & '""""""') & @LF)        ; Returns 1
ConsoleWrite(FileGetLongName(@AutoItExe & '""""""') & @LF)   ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetShortName(@AutoItExe & '""""""') & @LF)  ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetAttrib(@AutoItExe & '""""""') & @LF)     ; Returns A
ConsoleWrite(FileGetSize(@AutoItExe & '""""""') & @LF)       ; Returns 946784
ConsoleWrite(FileGetTime(@AutoItExe & '""""""', 0, 1) & @LF) ; Returns 20210611084604

ConsoleWrite(FileGetVersion(@AutoItExe & '""""""') & @LF)    ; Returns 0.0.0.0 (correct!)

comment:2 by J-Paul Mesnage, 5 years ago

Owner: set to J-Paul Mesnage
Status: newassigned

Fix sent to Jon

comment:3 by anonymous, 4 years ago

* ? < > " are wildcards. The results are expected if you consider what " does.

View https://docs.microsoft.com/en-us/archive/blogs/jeremykuhne/wildcards-in-windows

comment:4 by Jon, 4 years ago

Milestone: 3.3.15.5
Owner: changed from J-Paul Mesnage to Jon
Resolution: Fixed
Status: assignedclosed

Fixed by revision [12628] in version: 3.3.15.5

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.