Skip to content

Error when downloading files from Unix(Linux) to Windows OS, if the letter case is different with the same name. #1794

@JurasskPark

Description

@JurasskPark

If the Unix and Linux operating systems allow you to create files with the same name but different case. For example.
[C:\tmp\TEST\check.txt] <- [/TEST/check.txt] [768 Bytes/seconds] [6 Bytes]
[C:\tmp\TEST\check.txt] <- [/TEST/CHeck.txt] [711 Bytes/seconds] [6 Bytes]
Then when downloading the file on Windows, there will be an error here.

FluentFTP\Client\Modules\FileDownloadModule.cs

		/// <summary>
		/// Create an FtpResult object for the given file to be downloaded, and check if the file passes the rules.
		/// </summary>
		private static void RecordFileToDownload(BaseFtpClient client, List<FtpRule> rules, List<FtpResult> results, Dictionary<string, bool> shouldExist, List<FtpResult> toDownload, FtpListItem remoteFile, string localFile, string remoteFilePath = null) {

			// create the result object
			FtpResult result;
			if (remoteFile != null) {
				result = new FtpResult() {
					Type = remoteFile.Type,
					Size = remoteFile.Size,
					Name = remoteFile.Name,
					RemotePath = remoteFile.FullName,
					LocalPath = localFile,
					IsDownload = true,
				};
			}
			else {
				result = new FtpResult() {
					Type = FtpObjectType.File,
					Size = 0,
					Name = remoteFilePath.GetFtpFileName(),
					RemotePath = remoteFilePath,
					LocalPath = localFile,
					IsDownload = true,
				};
			}

			// record the file
			results.Add(result);

			// only download the file if it passes all the rules
			if (FileRuleModule.FilePassesRules(client, result, rules, false, remoteFile)) {

				// record that this file/folder should exist
				shouldExist.Add(localFile.ToLower(), true);

				// only files are processed
				toDownload.Add(result);

			}
		}

This localFile.ToLower()
Because Net Core will not allow you to add keys with the same name to the dictionary.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions