mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
fix addon panic bug (#3026)
Signed-off-by: wangyike <wangyike_wyk@163.com> Fix lint Signed-off-by: wangyike <wangyike_wyk@163.com>
This commit is contained in:
@@ -537,3 +537,8 @@ func TestGetPatternFromItem(t *testing.T) {
|
||||
assert.Equal(t, res, tc.meetPattern, tc.caseName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGitLabReaderNotPanic(t *testing.T) {
|
||||
_, err := NewAsyncReader("https://gitlab.com/test/catalog", "", "addons", "", gitType)
|
||||
assert.EqualError(t, err, "git type repository only support github for now")
|
||||
}
|
||||
|
||||
+2
-2
@@ -127,8 +127,8 @@ func NewAsyncReader(baseURL, bucket, subPath, token string, rdType ReaderType) (
|
||||
return nil, errors.New("addon registry invalid")
|
||||
}
|
||||
u.Path = path.Join(u.Path, subPath)
|
||||
tp, content, err := utils.Parse(u.String())
|
||||
if err != nil || tp != utils.TypeGithub {
|
||||
_, content, err := utils.Parse(u.String())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
gith := createGitHelper(content, token)
|
||||
|
||||
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
@@ -117,6 +118,7 @@ func Parse(addr string) (string, *Content, error) {
|
||||
},
|
||||
nil
|
||||
default:
|
||||
return "", nil, fmt.Errorf("git type repository only support github for now")
|
||||
}
|
||||
case "oss":
|
||||
return TypeOss, &Content{
|
||||
|
||||
Reference in New Issue
Block a user