File Submission Blacklisted Character config
Default characters are chosen to avoid potential issues within the URI and FS
This commit is contained in:
@ -267,4 +267,6 @@ optional:{default}
|
|||||||
submissionAllowedFiletypes={rar|zip|7z} Allowed file extensions like rar|zip|7z|webm|avi etc;
|
submissionAllowedFiletypes={rar|zip|7z} Allowed file extensions like rar|zip|7z|webm|avi etc;
|
||||||
submissionMaxFileNameSize={255} 12 characters are used for hash, How big a file name can be the default persumes the NAME_MAX length within common file systems
|
submissionMaxFileNameSize={255} 12 characters are used for hash, How big a file name can be the default persumes the NAME_MAX length within common file systems
|
||||||
submissionMaxFilePathSize={4096} How big a file path can be the default persumes the PATH_MAX length within common file systems
|
submissionMaxFilePathSize={4096} How big a file path can be the default persumes the PATH_MAX length within common file systems
|
||||||
|
submissionBlacklistedCharacters={#|%|&|{|}|\|<|>|*|?|/|$|!|'|"|:|@|+|`|=|\|} #default blacklist of characters that may cause issues can be overwritten, For "|" and "=" write it as "OR" and "EQUAL" since the config splits by | and =
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
# submissionAllowedFiletypes={rar|zip|7z} # Allowed file extensions like rar|zip|7z|webm|avi etc;
|
# submissionAllowedFiletypes={rar|zip|7z} # Allowed file extensions like rar|zip|7z|webm|avi etc;
|
||||||
# submissionMaxFileNameSize={255} # 12 characters are used for hash, How big a file name can be the default persumes the NAME_MAX length within common file systems
|
# submissionMaxFileNameSize={255} # 12 characters are used for hash, How big a file name can be the default persumes the NAME_MAX length within common file systems
|
||||||
# submissionMaxFilePathSize={4096} # How big a file path can be the default persumes the PATH_MAX length within common file systems
|
# submissionMaxFilePathSize={4096} # How big a file path can be the default persumes the PATH_MAX length within common file systems
|
||||||
|
# submissionBlacklistedCharacters={#|%|&|{|}|\|<|>|*|?|/|$|!|'|"|:|@|+|`|=|\|} #default blacklist of characters that may cause issues can be overwritten, For "|" and "=" write it as "OR" and "EQUAL" since the config splits by | and =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -61,5 +65,6 @@ submissionMaxStorageDurationH=24;
|
|||||||
submissionAllowedFiletypes=rar|zip|7z|arc|jpg|jpeg|png|mp4|webm;
|
submissionAllowedFiletypes=rar|zip|7z|arc|jpg|jpeg|png|mp4|webm;
|
||||||
submissionMaxFileNameSize=255;
|
submissionMaxFileNameSize=255;
|
||||||
submissionMaxFilePathSize=4096;
|
submissionMaxFilePathSize=4096;
|
||||||
|
submissionBlacklistedCharacters=#|%|&|{|}|\|<|>|*|?|/|$|!|'|"|:|@|+|`|EQUAL|OR;
|
||||||
|
|
||||||
#configend#
|
#configend#
|
||||||
|
@ -161,6 +161,7 @@ namespace Utilities {
|
|||||||
int submissionMaxFileNameSize = 255;
|
int submissionMaxFileNameSize = 255;
|
||||||
int submissionMaxFilePathSize = 4096;
|
int submissionMaxFilePathSize = 4096;
|
||||||
int baseDirectoryPathSize = 0;
|
int baseDirectoryPathSize = 0;
|
||||||
|
std::vector<std::string> submissionBlacklistedCharacters = {"#","%","&","{","}","\\","<",">","*","?","/","$","!","'","\"",":","@","+","`","=","|"};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calculates absolute file path length based on submission directory and current path
|
* calculates absolute file path length based on submission directory and current path
|
||||||
@ -330,6 +331,18 @@ namespace Utilities {
|
|||||||
submissionMaxFilePathSize = std::stoi(lineString);
|
submissionMaxFilePathSize = std::stoi(lineString);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (lineVector.at(0) == "submissionBlacklistedCharacters") {
|
||||||
|
submissionBlacklistedCharacters = Utilities::splitStringIntoVector(lineString, '|');
|
||||||
|
if (lineString.find("EQUAL") != std::string::npos || lineString.find("OR") != std::string::npos) {
|
||||||
|
for (std::string& submissionBlacklistedCharacter : submissionBlacklistedCharacters) {
|
||||||
|
if (submissionBlacklistedCharacter == "EQUAL")
|
||||||
|
submissionBlacklistedCharacter = "=";
|
||||||
|
if (submissionBlacklistedCharacter == "OR")
|
||||||
|
submissionBlacklistedCharacter = "|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user