Page 1 of 1

2 display issues with compiled FileZilla

Posted: 2020-04-23 16:15
by test
Hi Tim!
You are doing great work! :D

I am facing 2 issues related to display in the compiled FileZilla.

1) While displaying any directory list on remote side after successful connection, it shows question mark (?) on directory icon.

doubt1.png
doubt1.png (101.09 KiB) Viewed 487 times

I am able to successfully create/enter/list/upload/delete/download directories/files. What might be the reason behind it?


2) After downloading/uploading file successfully to/from Storj, File transfer successful, transferred 0 bytes in ..... seconds is displayed in Status Bar

This time of download/upload duration (in seconds) is correctly displayed. But, the downloaded/uploaded file size is always incorrectly displayed as 0 bytes only for Storj file transfer (For FTP/SFTP file transfer, the file size is displayed correctly)
(Even though the file size after Storj download/upload operation is displayed correctly on both local site view as well as remote site view)

doubt2.png
doubt2.png (95.37 KiB) Viewed 488 times

I found out that the backend code behind 2) is function void CControlSocket::LogTransferResultMessage(int nErrorCode, CFileTransferOpData *pData) in file /filezilla/src/engine/ControlSocket.cpp.

That code is:

Code: Select all

void CControlSocket::LogTransferResultMessage(int nErrorCode, CFileTransferOpData *pData)
{
	bool tmp{};

	CTransferStatus const status = engine_.transfer_status_.Get(tmp);
	if (!status.empty() && (nErrorCode == FZ_REPLY_OK || status.madeProgress)) {
		int elapsed = static_cast<int>((fz::datetime::now() - status.started).get_seconds());
		if (elapsed <= 0) {
			elapsed = 1;
		}
		std::wstring time = fz::sprintf(fztranslate("%d second", "%d seconds", elapsed), elapsed);

		int64_t transferred = status.currentOffset - status.startOffset;
		std::wstring size = CSizeFormatBase::Format(&engine_.GetOptions(), transferred, true);

		logmsg::type msgType = logmsg::error;
		std::wstring msg;
		if (nErrorCode == FZ_REPLY_OK) {
			msgType = logmsg::status;
			msg = _("File transfer successful, transferred %s in %s");
		}
		else if ((nErrorCode & FZ_REPLY_CANCELED) == FZ_REPLY_CANCELED) {
			msg = _("File transfer aborted by user after transferring %s in %s");
		}
		else if ((nErrorCode & FZ_REPLY_CRITICALERROR) == FZ_REPLY_CRITICALERROR) {
			msg = _("Critical file transfer error after transferring %s in %s");
		}
		else {
			msg = _("File transfer failed after transferring %s in %s");
		}
		log(msgType, msg, size, time);
	}
	else {
		if ((nErrorCode & FZ_REPLY_CANCELED) == FZ_REPLY_CANCELED) {
			log(logmsg::error, _("File transfer aborted by user"));
		}
		else if (nErrorCode == FZ_REPLY_OK) {
			if (pData->transferInitiated_) {
				log(logmsg::status, _("File transfer successful"));
			}
			else {
				log(logmsg::status, _("File transfer skipped"));
			}
		}
		else if ((nErrorCode & FZ_REPLY_CRITICALERROR) == FZ_REPLY_CRITICALERROR) {
			log(logmsg::error, _("Critical file transfer error"));
		}
		else {
			log(logmsg::error, _("File transfer failed"));
		}
	}
}

I tried replacing

Code: Select all

log(msgType, msg, size, time);
by

Code: Select all

log(msgType, msg, status.currentOffset, time);
Then after new upload/download, I got the message File transfer successful, transferred 0 in .... seconds
which probably means that status.currentOffset is still zero.

The relevant code in my /filezilla/src/fzstorj.cpp is:

Code: Select all

else if (command == "get") {
	size_t pos = arg.find(' ');
	if (pos == std::string::npos) {
		fzprintf(storjEvent::Error, "Bad arguments");
		continue;
	}
	std::string bucket = arg.substr(0, pos);
	size_t pos2 = arg.find(' ', pos + 1);
	if (pos == std::string::npos) {
		fzprintf(storjEvent::Error, "Bad arguments");
		continue;
	}
	auto id = arg.substr(pos + 1, pos2 - pos - 1);
	auto file = arg.substr(pos2 + 1);

	if (file.size() >= 3 && file.front() == '"' && file.back() == '"') {
		file = fz::replaced_substrings(file.substr(1, file.size() - 2), "\"\"", "\"");
	}
			
	ProjectResult project_result = fv_openStorjProject();
	fv_downloadObject(project_result.project, bucket, id, file);
		
	fzprintf(storjEvent::Done);			
}
I am unable to figure out the above.

Kindly help
Thanks!

Re: 2 display issues with compiled FileZilla

Posted: 2020-04-23 16:25
by boco
1) The question marks are normal and mean "unvisited". Other than local directories, remote ones can not be enumerated automatically (process is too heavy on the server). FileZilla simply doesn't know if and what's in them until you visit them once - then they are known until you close FileZilla.

Re: 2 display issues with compiled FileZilla

Posted: 2020-04-23 17:17
by botg
You need to update the download progress.

Re: 2 display issues with compiled FileZilla

Posted: 2020-04-24 08:53
by test
I tried using fzprintf(storjEvent::Transfer, "%u", .....<variable name>.....) in fzstorj.cpp & it worked

Thanks! :D