mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Allow arbitrary name in fstream url after hash.
/fstream/fileshash/name Useful for creating file links that contains the original file name.
This commit is contained in:
parent
c4563dbb96
commit
bdc70c6561
@ -275,11 +275,20 @@ public:
|
||||
sendMessage(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "Error: rsFiles is null. Retroshare is probably not yet started.");
|
||||
return MHD_YES;
|
||||
}
|
||||
if(url[0] == 0 || (mHash=RsFileHash(url+strlen(FILESTREAMER_ENTRY_PATH))).isNull())
|
||||
{
|
||||
sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: URL is not a valid file hash");
|
||||
return MHD_YES;
|
||||
}
|
||||
std::string urls(url);
|
||||
urls = urls.substr(strlen(FILESTREAMER_ENTRY_PATH));
|
||||
size_t perpos = urls.find('/');
|
||||
if(perpos == std::string::npos){
|
||||
mHash = RsFileHash(urls);
|
||||
}else{
|
||||
mHash = RsFileHash(urls.substr(0, perpos));
|
||||
}
|
||||
if(urls.empty() || mHash.isNull())
|
||||
{
|
||||
sendMessage(connection, MHD_HTTP_NOT_FOUND, "Error: URL is not a valid file hash");
|
||||
return MHD_YES;
|
||||
}
|
||||
|
||||
FileInfo info;
|
||||
std::list<RsFileHash> dls;
|
||||
rsFiles->FileDownloads(dls);
|
||||
|
Loading…
Reference in New Issue
Block a user