Files
2021-05-20 18:56:06 +03:00

51 lines
2.5 KiB
Diff

diff --git a/src/libappimage/utils/StringSanitizer.cpp b/src/libappimage/utils/StringSanitizer.cpp
index fee9f7d..521d82e 100644
--- a/src/libappimage/utils/StringSanitizer.cpp
+++ b/src/libappimage/utils/StringSanitizer.cpp
@@ -13,6 +13,20 @@ std::string StringSanitizer::sanitizeForPath() {
std::vector<std::string::value_type> buffer{};
buffer.reserve(input_.size());
+ // these three lists can be used to compose alphabets for sanitization
+ static constexpr std::initializer_list<std::string::value_type> asciiLetters_ = {
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ };
+ static constexpr std::initializer_list<std::string::value_type> asciiDigits_ = {
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ };
+ static constexpr std::initializer_list<std::string::value_type> pathSafeChars_ = {
+ '.', '-', '_'
+ };
+
// first of all, we compose an alphabet of safe characters
// all characters not contained in this alphabet will be replaced by some safe character, e.g., an underscore (_)
std::vector<std::string::value_type> safeAlphabet{asciiDigits_.size() + asciiLetters_.size() + pathSafeChars_.size()};
diff --git a/src/libappimage/utils/StringSanitizer.h b/src/libappimage/utils/StringSanitizer.h
index 5301ec1..9919ed6 100644
--- a/src/libappimage/utils/StringSanitizer.h
+++ b/src/libappimage/utils/StringSanitizer.h
@@ -10,20 +10,6 @@ class StringSanitizer {
private:
std::string input_;
- // these three lists can be used to compose alphabets for sanitization
- static constexpr std::initializer_list<std::string::value_type> asciiLetters_ = {
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- };
- static constexpr std::initializer_list<std::string::value_type> asciiDigits_ = {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- };
- static constexpr std::initializer_list<std::string::value_type> pathSafeChars_ = {
- '.', '-', '_'
- };
-
public:
/**
* Default constructor.