This commit replaces the Axum/Rust backend with a Gin/Go implementation. The original Rust code has been archived in the 'rust' branch.
20 lines
362 B
Go
20 lines
362 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func ParseDataURL(dataURL string) (string, string, error) {
|
|
if !strings.HasPrefix(dataURL, "data:") {
|
|
return "", "", fmt.Errorf("not a data URL")
|
|
}
|
|
|
|
parts := strings.Split(dataURL[5:], ";base64,")
|
|
if len(parts) != 2 {
|
|
return "", "", fmt.Errorf("invalid data URL format")
|
|
}
|
|
|
|
return parts[0], parts[1], nil
|
|
}
|