mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 06:22:28 +03:00
Merge pull request #3802 from anaisbetts/disallow-unc-paths
Disallow UNC paths
This commit is contained in:
commit
0085c0901d
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.sh eol=lf
|
@ -4,5 +4,6 @@
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ export class ProjectService {
|
||||
const path = await this.promptForDirectory();
|
||||
if (!path) return;
|
||||
|
||||
if (!this.validateProjectPath(path)) return;
|
||||
|
||||
try {
|
||||
const project = await this.add(path);
|
||||
if (!project) return;
|
||||
@ -118,6 +120,32 @@ export class ProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
validateProjectPath(path: string, showErrors = true) {
|
||||
if (/^\\\\wsl.localhost/i.test(path)) {
|
||||
if (showErrors) {
|
||||
showError(
|
||||
'Use the Linux version of GitButler',
|
||||
'For WSL2 projects, install the Linux version of GitButler inside of your WSL2 distro'
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (/^\\\\/i.test(path)) {
|
||||
if (showErrors) {
|
||||
showError(
|
||||
'UNC Paths are not directly supported',
|
||||
'Using git across a network is not recommended. Either clone the repo locally, or use the NET USE command to map a network drive'
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
getLastOpenedProject() {
|
||||
return get(this.persistedId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user