mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
Feature/unicode groupname validation (#1600)
Allow all UTF-8 characters except URL identifiers as user and group names and for namespaces. Fixes #1513 Co-authored-by: René Pfeuffer <rene.pfeuffer@cloudogu.com>
This commit is contained in:
@@ -43,9 +43,12 @@ public class CustomNamespaceStrategy implements NamespaceStrategy {
|
||||
doThrow()
|
||||
.violation("invalid namespace", "namespace")
|
||||
.when(
|
||||
!ValidationUtil.isRepositoryNameValid(namespace)
|
||||
!ValidationUtil.isNameValid(namespace)
|
||||
|| ONE_TO_THREE_DIGITS.matcher(namespace).matches()
|
||||
|| namespace.equals("create"));
|
||||
|| namespace.equals("create")
|
||||
|| namespace.equals("import")
|
||||
|| namespace.equals("..")
|
||||
);
|
||||
|
||||
return namespace;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -32,6 +32,6 @@ public class UsernameNamespaceStrategy implements NamespaceStrategy {
|
||||
|
||||
@Override
|
||||
public String createNamespace(Repository repository) {
|
||||
return SecurityUtils.getSubject().getPrincipal().toString();
|
||||
return SecurityUtils.getSubject().getPrincipal().toString().replaceAll("\\s", "_");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user