-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Closed as not planned
Labels
Description
There is an issue with access to filenames with >= 260 characters in the Windows version of curl.
I used this <curl_root>\upload-long-file.bat
file to verify:
@echo off
setlocal
::
:: File to upload: 261 bytes long (446 bytes) [1]
::
set LONG_FILE=f:\MingW32\src\GUI\Harlinn\2022.01.11\Tests\3rdParty\gdal\data\gdrivers\sentinel2\fake_l2a_MSIL2Ap\S2A_MSIL2A_20170823T094031_N0205_R036_T34VFJ_20170823T094252.SAFE\GRANULE\L2A_T34VFJ_A011330_20170823T094252\IMG_DATA\R60m\L2A_T34VFJ_20170823T094031_AOT_60m.jp2
::
:: A copy of the above, but 260 bytes long
::
set SHORT_FILE=f:\MingW32\src\GUI\Harlinn\2022.01.11\Tests\3rdParty\gdal\data\gdrivers\sentinel2\fake_l2a_MSIL2Ap\S2A_MSIL2A_20170823T094031_N0205_R036_T34VFJ_20170823T094252.SAFE\GRANULE\L2A_T34VFJ_A011330_20170823T094252\IMG_DATA\R60m\L2A_T34VFJ_20170823T094031_AOT_60m.jp
set URL=ftp://ftp.xxx.yyy.com
if %1. == long. (
echo on
%~dp0\src\curl.exe -vT %LONG_FILE% %URL%
) else (
echo on
%~dp0\src\curl.exe -vT %SHORT_FILE% %URL%
)
With a upload-long-file.bat long
, curl fails to open the %LONG_FILE
:
curl: Can't open 'f:\MingW32\src\GUI\Harlinn\2022.01.11\Tests\3rdParty\gdal\data\gdrivers\sentinel2\fake_l2a_MSIL2Ap\
S2A_MSIL2A_20170823T094031_N0205_R036_T34VFJ_20170823T094252.SAFE\GRANULE\
L2A_T34VFJ_A011330_20170823T094252\IMG_DATA\R60m\L2A_T34VFJ_20170823T094031_AOT_60m.jp2'!
curl: try 'curl --help' or 'curl --manual' for more information
curl: (26) Failed to open/read local data from file/application
Seems the problem is here which does not support such long-filenames AFAICS.
According to MSDN, this needs CreateFileW() as "\\?\" + per->uploadfile
.
curl/libcurl version
curl 7.82.0-DEV (i386-pc-win32) libcurl/7.82.0-DEV wolfSSL/5.0.1 (GnuTLS/3.7.2) (mbedTLS/2.25.0) (OpenSSL/3.1.0)
(Schannel) (rustls-ffi/0.8.2/rustls/0.20.2) zlib/1.2.11 brotli/1.0.9 zstd/1.5.2 c-ares/1.18.1 WinIDN libpsl/0.21.1
(no IDNA support) libssh2/1.9.0_DEV librtmp/2.3
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb
smbs smtp smtps telnet tftp
Features: AsynchDNS Debug HSTS IDN Kerberos Largefile MultiSSL NTLM PSL SPNEGO SSL SSPI TLS-SRP TrackMemory
UnixSockets alt-svc brotli libz zstd
operating system
Windows-10, 21H1, 19043.1503.
[1] From the "Geospatial Data Abstraction Library" project.