{"record":{"id":"015376bd1cd6962e","repo":"yorukot/superfile","slug":"file-name-cannot-end-with-c-or-c","errorCode":null,"errorMessage":"file name cannot end with '%c.' or '%c..'","messagePattern":"file name cannot end with '%c\\.' or '%c\\.\\.'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/internal/function.go","lineNumber":56,"sourceCode":"\t// exclude timemachine on macOS\n\tif strings.HasPrefix(path, \"/Volumes/.timemachine\") {\n\t\treturn false\n\t}\n\n\t// to filter out mounted partitions like /, /boot etc\n\treturn strings.HasPrefix(path, \"/mnt\") ||\n\t\tstrings.HasPrefix(path, \"/media\") ||\n\t\tstrings.HasPrefix(path, \"/run/media\") ||\n\t\tstrings.HasPrefix(path, \"/Volumes\")\n}\n\nfunc checkFileNameValidity(name string) error {\n\tswitch {\n\tcase name == \".\", name == \"..\":\n\t\treturn errors.New(\"file name cannot be '.' or '..'\")\n\tcase strings.HasSuffix(name, fmt.Sprintf(\"%c.\", filepath.Separator)),\n\t\tstrings.HasSuffix(name, fmt.Sprintf(\"%c..\", filepath.Separator)):\n\t\treturn fmt.Errorf(\"file name cannot end with '%c.' or '%c..'\", filepath.Separator, filepath.Separator)\n\tdefault:\n\t\treturn nil\n\t}\n}\n\nfunc renameIfDuplicate(destination string) (string, error) {\n\tif _, err := os.Stat(destination); os.IsNotExist(err) {\n\t\treturn destination, nil\n\t} else if err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdir := filepath.Dir(destination)\n\tbase := filepath.Base(destination)\n\text := filepath.Ext(base)\n\tname := base[:len(base)-len(ext)]\n\n\t// Extract base name without existing suffix","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/yorukot/superfile/blob/b72f550bc6e75913f48eb49fdd258e1a2df2fe88/src/internal/function.go#L38-L74","documentation":"Error \"file name cannot end with '%c.' or '%c..'\" thrown in yorukot/superfile.","triggerScenarios":"Thrown at src/internal/function.go:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b72f550bc6e75913f48eb49fdd258e1a2df2fe88","analyzedAt":"2026-09-01T04:38:08.254Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}