@@ -91,6 +91,16 @@ var UploadCommand = cli.Command{
9191 },
9292 },
9393 Action : func (cCtx * cli.Context ) error {
94+ user , err := supabase .Auth .User (ctx , settings .AccessToken )
95+
96+ if err != nil {
97+ cli .Exit ("You don't seem to be signed in. Try running `openbin login` to sign in." , 1 )
98+ }
99+
100+ if user == nil {
101+ cli .Exit ("You don't seem to be signed in. Try running `openbin login` to sign in." , 1 )
102+ }
103+
94104 args := UploadOptions {
95105 File : cCtx .Args ().First (),
96106 Editor : cCtx .String ("editor" ),
@@ -104,6 +114,13 @@ var UploadCommand = cli.Command{
104114 Quiet : cCtx .Bool ("quiet" ),
105115 }
106116
117+ if args .File != "" {
118+ // Check if the file exists
119+ if _ , err := os .Stat (args .File ); os .IsNotExist (err ) {
120+ return cli .Exit ("The file you specified does not exist." , 1 )
121+ }
122+ }
123+
107124 if args .Language == "" {
108125 // Try to get the language from the file extension
109126 if args .File != "" {
@@ -229,6 +246,10 @@ func UploadFile(path string, opts UploadOptions) {
229246 cli .Exit ("You don't seem to be signed in. Try running `openbin login` to sign in." , 1 )
230247 }
231248
249+ if user == nil {
250+ cli .Exit ("You don't seem to be signed in. Try running `openbin login` to sign in." , 1 )
251+ }
252+
232253 supabase .DB .AddHeader ("Authorization" , fmt .Sprintf ("Bearer %s" , settings .AccessToken ))
233254
234255 err = supabase .DB .From ("pastes" ).Insert (map [string ]interface {}{
0 commit comments