| 166 | } |
| 167 | |
| 168 | func (d *Github) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error) { |
| 169 | obj, err := d.get(file.GetPath()) |
| 170 | if err != nil { |
| 171 | return nil, err |
| 172 | } |
| 173 | if obj.Type == "submodule" { |
| 174 | return nil, errors.New("cannot download a submodule") |
| 175 | } |
| 176 | url := obj.DownloadURL |
| 177 | ghProxy := strings.TrimSpace(d.Addition.GitHubProxy) |
| 178 | if ghProxy != "" { |
| 179 | url = strings.Replace(url, "https://raw.githubusercontent.com", ghProxy, 1) |
| 180 | } |
| 181 | return &model.Link{ |
| 182 | URL: url, |
| 183 | }, nil |
| 184 | } |
| 185 | |
| 186 | func (d *Github) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error { |
| 187 | if !d.isOnBranch { |