fix(share): allow special characters in share passwords (#2528)
Passwords containing emoji or URI-reserved characters produced an unparseable cloudreve:// share URI, and the create/update binding rejected anything non-alphanumeric. - NewShareUri percent-encodes the userinfo via url.UserPassword; the parse side already decodes it - drop the alphanum binding on ShareCreateService.Password - round-trip test covers emoji, spaces, and reserved characters Authored By: TDvorak <info@tdvorak.dev> Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>pull/3582/head
parent
5817da287a
commit
b85216fd51
@ -0,0 +1,21 @@
|
||||
package fs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestShareUriPasswordRoundTrip(t *testing.T) {
|
||||
for _, password := range []string{"plain", "with space", "a:b@c/d?e", "😀😴😭", "$%^&*"} {
|
||||
u, err := NewUriFromString(NewShareUri("abc123", password))
|
||||
require.NoError(t, err, "password %q", password)
|
||||
require.Equal(t, "abc123", u.ID(""))
|
||||
require.Equal(t, password, u.Password(), "password %q", password)
|
||||
}
|
||||
|
||||
u, err := NewUriFromString(NewShareUri("abc123", ""))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "abc123", u.ID(""))
|
||||
require.Equal(t, "", u.Password())
|
||||
}
|
||||
Loading…
Reference in new issue