Line data Source code
1 : // Copyright (C) 2017 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.extensions.api.lfs; 16 : 17 : import com.google.common.base.Joiner; 18 : 19 : public final class LfsDefinitions { 20 : public static final String CONTENTTYPE_VND_GIT_LFS_JSON = 21 : "application/vnd.git-lfs+json; charset=utf-8"; 22 : 23 : public static final String LFS_OBJECTS_PATH = "objects/batch"; 24 : public static final String LFS_LOCKS_PATH_REGEX = "locks(?:/(.*)(?:/unlock))?"; 25 : public static final String LFS_VERIFICATION_PATH = "locks/verify"; 26 100 : public static final String LFS_UNIFIED_PATHS_REGEX = 27 100 : Joiner.on('|').join(LFS_OBJECTS_PATH, LFS_LOCKS_PATH_REGEX, LFS_VERIFICATION_PATH); 28 : public static final String LFS_URL_WO_AUTH_REGEX_TEAMPLATE = "(?:/p/|/)(.+)(?:/info/lfs/)(?:%s)$"; 29 100 : public static final String LFS_URL_WO_AUTH_REGEX = 30 100 : String.format(LFS_URL_WO_AUTH_REGEX_TEAMPLATE, LFS_UNIFIED_PATHS_REGEX); 31 : public static final String LFS_URL_REGEX_TEMPLATE = "^(?:/a)?" + LFS_URL_WO_AUTH_REGEX_TEAMPLATE; 32 100 : public static final String LFS_URL_REGEX = 33 100 : String.format(LFS_URL_REGEX_TEMPLATE, LFS_UNIFIED_PATHS_REGEX); 34 : 35 : private LfsDefinitions() {} 36 : }