fix unable to reset password on ios (#4016)

This commit is contained in:
frank 2023-09-13 08:21:13 +08:00 committed by GitHub
parent 1b07ecaaf7
commit e72a033930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -1 +1 @@
0.166.8 0.166.9

View File

@ -1030,7 +1030,19 @@ func (b *GethStatusBackend) createTempDBFile(pattern string) (tmpDbPath string,
err = errors.New("root datadir wasn't provided") err = errors.New("root datadir wasn't provided")
return return
} }
file, err := os.CreateTemp(filepath.Dir(b.rootDataDir), "*-"+pattern) rootDataDir := b.rootDataDir
//On iOS, the rootDataDir value does not contain a trailing slash.
//This is causing an incorrectly formatted temporary file path to be generated, leading to an "operation not permitted" error.
//e.g. value of rootDataDir is `/var/mobile/.../12906D5A-E831-49E9-BBE7-5FFE8E805D8A/Library`,
//the file path generated is something like `/var/mobile/.../12906D5A-E831-49E9-BBE7-5FFE8E805D8A/123-v4.db`
//which removed `Library` from the path.
if !strings.HasSuffix(rootDataDir, "/") {
rootDataDir += "/"
}
file, err := os.CreateTemp(filepath.Dir(rootDataDir), "*-"+pattern)
if err != nil {
return
}
tmpDbPath = file.Name() tmpDbPath = file.Name()
cleanup = func() { cleanup = func() {
filePath := file.Name() filePath := file.Name()