mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel
This commit is contained in:
commit
00c9955ed2
|
@ -385,10 +385,7 @@ TRI_aql_node_t* TRI_CreateNodeCollectionAql (TRI_aql_context_t* const context,
|
|||
return NULL;
|
||||
}
|
||||
else {
|
||||
TRI_col_parameter_t parameters;
|
||||
|
||||
parameters._isSystem = true;
|
||||
if (! TRI_IsAllowedCollectionName(¶meters, name)) {
|
||||
if (! TRI_IsAllowedCollectionName(true, name)) {
|
||||
TRI_SetErrorContextAql(context, TRI_ERROR_ARANGO_ILLEGAL_NAME, name);
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -673,11 +673,9 @@ static TRI_vocbase_col_t* BearCollectionVocBase (TRI_vocbase_t* vocbase,
|
|||
TRI_col_type_e type) {
|
||||
union { void const* v; TRI_vocbase_col_t* c; } found;
|
||||
TRI_vocbase_col_t* collection;
|
||||
TRI_col_parameter_t parameter;
|
||||
|
||||
// check that the name does not contain any strange characters
|
||||
parameter._isSystem = false;
|
||||
if (! TRI_IsAllowedCollectionName(¶meter, name)) {
|
||||
if (! TRI_IsAllowedCollectionName(false, name)) {
|
||||
TRI_set_errno(TRI_ERROR_ARANGO_ILLEGAL_NAME);
|
||||
|
||||
return NULL;
|
||||
|
@ -997,13 +995,13 @@ size_t PageSize;
|
|||
/// Returns true if the name is allowed and false otherwise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IsAllowedCollectionName (TRI_col_parameter_t* paramater, char const* name) {
|
||||
bool TRI_IsAllowedCollectionName (bool isSystem, char const* name) {
|
||||
bool ok;
|
||||
char const* ptr;
|
||||
size_t length = 0;
|
||||
|
||||
for (ptr = name; *ptr; ++ptr) {
|
||||
if (name < ptr || paramater->_isSystem) {
|
||||
if (name < ptr || isSystem) {
|
||||
ok = (*ptr == '_') || (*ptr == '-') || ('0' <= *ptr && *ptr <= '9') || ('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z');
|
||||
}
|
||||
else {
|
||||
|
@ -1421,7 +1419,7 @@ TRI_vocbase_col_t* TRI_CreateCollectionVocBase (TRI_vocbase_t* vocbase,
|
|||
name = parameter->_name;
|
||||
|
||||
// check that the name does not contain any strange characters
|
||||
if (! TRI_IsAllowedCollectionName(parameter, name)) {
|
||||
if (! TRI_IsAllowedCollectionName(parameter->_isSystem, name)) {
|
||||
TRI_set_errno(TRI_ERROR_ARANGO_ILLEGAL_NAME);
|
||||
|
||||
return NULL;
|
||||
|
@ -1690,7 +1688,6 @@ int TRI_DropCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* collec
|
|||
int TRI_RenameCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* collection, char const* newName) {
|
||||
union { TRI_vocbase_col_t* v; TRI_vocbase_col_t const* c; } cnv;
|
||||
TRI_col_info_t info;
|
||||
TRI_col_parameter_t parameter;
|
||||
void const* found;
|
||||
char const* oldName;
|
||||
int res;
|
||||
|
@ -1702,8 +1699,7 @@ int TRI_RenameCollectionVocBase (TRI_vocbase_t* vocbase, TRI_vocbase_col_t* coll
|
|||
return TRI_ERROR_NO_ERROR;
|
||||
}
|
||||
|
||||
parameter._isSystem = (*oldName == '_');
|
||||
if (! TRI_IsAllowedCollectionName(¶meter, newName)) {
|
||||
if (! TRI_IsAllowedCollectionName((*oldName == '_'), newName)) {
|
||||
return TRI_set_errno(TRI_ERROR_ARANGO_ILLEGAL_NAME);
|
||||
}
|
||||
|
||||
|
|
|
@ -448,7 +448,7 @@ TRI_vocbase_col_t;
|
|||
/// @brief checks if a collection is allowed
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool TRI_IsAllowedCollectionName (struct TRI_col_parameter_s*, char const*);
|
||||
bool TRI_IsAllowedCollectionName (bool isSystem, char const*);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief create a new tick
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "BasicsC/conversions.h"
|
||||
#include "BasicsC/strings.h"
|
||||
#include "BasicsC/utf8-helper.h"
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
@ -1005,7 +1006,20 @@ vector<string> const& HttpRequest::suffix () const {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HttpRequest::addSuffix (char const* part) {
|
||||
_suffix.push_back(part);
|
||||
#ifdef TRI_HAVE_ICU
|
||||
string decoded = StringUtils::urlDecode(part);
|
||||
size_t tmpLength = 0;
|
||||
char* utf8_nfc = TR_normalize_utf8_to_NFC(TRI_UNKNOWN_MEM_ZONE, decoded.c_str(), decoded.length(), &tmpLength);
|
||||
if (utf8_nfc) {
|
||||
_suffix.push_back(utf8_nfc);
|
||||
TRI_Free(TRI_UNKNOWN_MEM_ZONE, utf8_nfc);
|
||||
}
|
||||
else {
|
||||
_suffix.push_back(decoded);
|
||||
}
|
||||
#else
|
||||
_suffix.push_back(StringUtils::urlDecode(part));
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue