(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestCreateRejectsUnsafeNames(t *testing.T) { |
| 177 | t.Parallel() |
| 178 | dir := bootstrapRepo(t) |
| 179 | root := t.TempDir() |
| 180 | |
| 181 | for _, name := range []string{ |
| 182 | "../escape", |
| 183 | "../../etc/evil", |
| 184 | "foo/bar", |
| 185 | `foo\bar`, |
| 186 | ".", |
| 187 | "..", |
| 188 | " leading", |
| 189 | "trailing ", |
| 190 | } { |
| 191 | t.Run(name, func(t *testing.T) { |
| 192 | t.Parallel() |
| 193 | _, err := Create(t.Context(), dir, name, WithRoot(root)) |
| 194 | assert.ErrorIs(t, err, ErrInvalidName) |
| 195 | }) |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | func TestCreateRejectsDuplicateName(t *testing.T) { |
| 200 | t.Parallel() |
nothing calls this directly
no test coverage detected