MCPcopy Create free account
hub / github.com/castai/openwebui-content-sync / isTextFile

Function isTextFile

internal/adapter/github.go:206–257  ·  view source on GitHub ↗

isTextFile checks if a file is likely to be a text file

(filename string)

Source from the content-addressed store, hash-verified

204
205// isTextFile checks if a file is likely to be a text file
206func isTextFile(filename string) bool {
207 ext := strings.ToLower(filepath.Ext(filename))
208
209 // Common text file extensions
210 textExts := map[string]bool{
211 ".md": true,
212 ".txt": true,
213 ".json": true,
214 ".yaml": true,
215 ".yml": true,
216 ".go": true,
217 ".py": true,
218 ".js": true,
219 ".ts": true,
220 ".java": true,
221 ".cpp": true,
222 ".c": true,
223 ".h": true,
224 ".hpp": true,
225 ".cs": true,
226 ".php": true,
227 ".rb": true,
228 ".rs": true,
229 ".swift": true,
230 ".kt": true,
231 ".scala": true,
232 ".sh": true,
233 ".bash": true,
234 ".zsh": true,
235 ".fish": true,
236 ".ps1": true,
237 ".sql": true,
238 ".xml": true,
239 ".html": true,
240 ".css": true,
241 ".scss": true,
242 ".sass": true,
243 ".less": true,
244 ".dockerfile": true,
245 ".gitignore": true,
246 ".gitattributes": true,
247 ".editorconfig": true,
248 ".env": true,
249 ".env.example": true,
250 ".env.local": true,
251 ".env.production": true,
252 ".env.development": true,
253 ".env.test": true,
254 }
255
256 return textExts[ext] || ext == ""
257}
258
259// GetLastSync returns the last sync timestamp
260func (g *GitHubAdapter) GetLastSync() time.Time {

Callers 2

processContentMethod · 0.85
TestIsTextFileFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsTextFileFunction · 0.68