Dropbox directory renaming resulting in 'URI::InvalidURIError: bad URI' on asset precompilation
Asked Answered
S

1

7

I just upgraded my Dropbox account from a personal account to a business account. As a result it changed my main dropbox name from just 'Dropbox' to 'Company Name Dropbox'.

Now when I try to either launch my rails app or do a rails assets:precompile I get the following error:

$ rails assets:precompile
yarn install v1.22.0
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
✨  Done in 0.15s.
rails aborted!
URI::InvalidURIError: bad URI(is not URI?): file-digest:///Users/name/Company Name Dropbox/Username/appfolder/jsp/app/assets/stylesheets/trestle/_variables.scss
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets/uri_utils.rb:45:in `split_file_uri'
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets/uri_utils.rb:126:in `parse_file_digest_uri'
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets.rb:159:in `block in <module:Sprockets>'
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets/dependencies.rb:67:in `resolve_dependency'
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:23:in `block in initialize'
/.rvm/gems/ruby-2.5.1@myapp/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:59:in `resolve_dependency'

I have updated to the latest available version of Rails 5.2.4.3.

How do I resolve this without changing the location of my project? I need to leave it within my Dropbox folder.

Strong answered 20/6, 2020 at 22:47 Comment(7)
Is it possible to rename the dropbox then? – Dispossess
@Dispossess unfortunately not :( What do you think is causing it in the name? – Strong
I'm guessing there might be invalid characters in your company name or change of permissions? Sorry not an expert on rails or dropbox, can't help much – Dispossess
I don't know how bussiness dropboxes are named, but do the spaces in the uri really exist? If so, you may add _ between the words of "company name dropbox" since I don't think it is valid to include spaces in the uri. – Octans
@Octans yeah I can't rename that part of the path. Dropbox handles that. – Strong
@Strong So you cannot touch the path by anyway? Maybe you can create a new sprockets task and manually resolve and gsub the uri? I'm not an expert on these things so I sorry I can't help much. – Octans
@Octans yeah I can't touch the path in anyway unfortunately :( – Strong
P
1

I think you need to use URI.encode(url) so that the whitespace is converted to %20.

Physostomous answered 4/7, 2020 at 18:14 Comment(2)
I know I need to use that, but use it where? – Strong
Post the portion of your rails app where you have 'Company Name Dropbox'. – Physostomous

© 2022 - 2024 β€” McMap. All rights reserved.