diff --git a/modules/renderer/connection/FileTransfer.ts b/modules/renderer/connection/FileTransfer.ts index d80911b..1f52501 100644 --- a/modules/renderer/connection/FileTransfer.ts +++ b/modules/renderer/connection/FileTransfer.ts @@ -113,7 +113,7 @@ namespace _transfer { if(data.size != this.transfer_key.total_size) throw "invalid size"; - throw "files arent yet supported"; + buffer = native.ft.upload_transfer_object_from_file(data.path, data.name); } else if(typeof(data) === "string") { if(data.length != this.transfer_key.total_size) throw "invalid size"; diff --git a/native/serverconnection/src/connection/ft/FileTransferObject.cpp b/native/serverconnection/src/connection/ft/FileTransferObject.cpp index c56490a..c4be3f3 100644 --- a/native/serverconnection/src/connection/ft/FileTransferObject.cpp +++ b/native/serverconnection/src/connection/ft/FileTransferObject.cpp @@ -178,7 +178,16 @@ void TransferObjectWrap::do_wrap(v8::Local object) { } #endif -TransferFileSource::TransferFileSource(std::string path, std::string name) : _path{std::move(path)}, _name{std::move(name)} { } +TransferFileSource::TransferFileSource(std::string path, std::string name) : _path{std::move(path)}, _name{std::move(name)} { + if(!this->_path.empty()) { + if(this->_path.back() == '/') + this->_path.pop_back(); +#ifdef WIN32 + if(this->_path.back() == '\\') + this->_path.pop_back(); +#endif + } +} #ifdef WIN32 #define u8path path