MCPcopy Index your code
hub / github.com/rclone/rclone / splitExtension

Function splitExtension

lib/transform/transform.go:249–267  ·  view source on GitHub ↗
(remote string)

Source from the content-addressed store, hash-verified

247}
248
249func splitExtension(remote string) (base, exts string) {
250 base = remote
251 var (
252 first = true
253 ext = path.Ext(remote)
254 )
255 for ext != "" {
256 // Look second and subsequent extensions in mime types.
257 // If they aren't found then don't keep it as an extension.
258 if !first && mime.TypeByExtension(ext) == "" {
259 break
260 }
261 base = base[:len(base)-len(ext)]
262 exts = ext + exts
263 first = false
264 ext = path.Ext(base)
265 }
266 return base, exts
267}
268
269func truncateChars(s string, max int, keepExtension bool) string {
270 if max <= 0 {

Callers 3

SuffixKeepExtensionFunction · 0.85
truncateCharsFunction · 0.85
truncateBytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…