Webdav plugin

Added by Arnaud Martel almost 4 years ago

Questions & problems related to webdav plugin

Replies (90)

RE: Webdav plugin - Added by Arnaud Martel almost 4 years ago

To continue issue #801:

Peter,

I don't see anything in your files that could explain the error.
Could you add the following line:
RAILS_DEFAULT_LOGGER.info "arg: #{args1}"

in the lib/file_resource.rb after line 33
and give me the result from the log/production.log file...

Arnaud

RE: Webdav plugin - Added by Arnaud Martel almost 4 years ago

oopps... Correct line is:

RAILS_DEFAULT_LOGGER.info "arg: #{args[1]}" 

RE: Webdav plugin - Added by Peter Philipp almost 4 years ago

Terence Mill,

I've updated my already existing documentation.
I tried to get it as general as possible.
Could you review it?

Thanks
Peter

RE: Webdav plugin - Added by Peter Philipp almost 4 years ago

Arnaud,

Here's the output:
RAILS_DEFAULT_LOGGER.info "arg: #{args[1]}"

arg: files/redmineWebDavLog.txt

RAILS_DEFAULT_LOGGER.info "arg: #{args}"
arg: Eurocentres 2.0 - Developm. A1files/redmineWebDavLog.txt/webdav/eurocentres20-int/files/redmineWebDavLog.txt

Peter

RE: Webdav plugin - Added by Arnaud Martel almost 4 years ago

Peter,

Just to be sure: you should have several lines in your log file with arg:..... (that's what I expected)
Could you give the complete traceback, please?

for example:

 Processing WebdavController#webdav (for 188.61.214.159 at 2010-10-23 00:18:44) [PROPFIND]
   Parameters: {"action"=>"webdav", "id"=>"eurocentres20-int", "controller"=>"webdav", "path_info"=> ["files"], "propfind"=>{"prop"=>{"getcontentlength"=>{"xmlns"=>"DAV:"}, "getlastmodified"=>{"xmlns"=>"DAV:"}, "creationdate"=>{"xmlns"=>"DAV:"}, "lastaccessed"=>{"xmlns"=>"DAV:"}, "resourcetype"=>{"xmlns"=>"DAV:"}}, "xmlns"=>"DAV:"}}

arg: files
arg: files/redmineWebDavLog.txt

 NoMethodError (undefined method `filename' for nil:NilClass):
  passenger (2.2.13) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  passenger (2.2.13) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
 ...
  passenger (2.2.13) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.13) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

And, what appends if you delete the file? Are you are able to access the files folder with webdav (to know if the problem is related to the folder or to the files inside the folder...)

Arnaud

RE: Webdav plugin - Added by Peter Philipp almost 4 years ago

Arnaud,

Ok set log-level back to INFO, now it looks better.
Attached the log that's created on a refresh of the /webdav/project/files folder.

Cheers,
Peter

RE: Webdav plugin - Added by Arnaud Martel almost 4 years ago

Peter,

Thanks for your log. Now I understand where is the problem: I think it is related to the versions you have created

arg: files/Milestone Online Marketing / SEO

This is an invalid version name for the Webdav plugin (using / is not allowed as it is the folder separator...).
Could you confirm my analyze (just rename the version which have an invalid name...) ??

Arnaud

RE: Webdav plugin - Added by Peter Philipp almost 4 years ago

Arnaud,

awesome it works - what a lame mistake :|
Thank you very much for your help.

What do you think would it be possible to
a) prevent saving illegal names by checking them in the forms in redmine - special validation by the webdav plugin
or
b) normalize such illegal characters with a search & replace action. E.g.

files/Milestone Online Marketing / SEO
would become
files/Milestone Online Marketing _ SEO

or
c) add some significant error message into the log if there's an illegal character in a name

Of course the approaches a) & b) are not easy to implement since there will be side-effects.
E.g. b) would affect the way name relations are made in the whole webdav/db stuff.

^^ Just suggestions, I'm happy so far :D

Thanks again & best regards
Peter

RE: Webdav plugin - Added by Terence Mill over 3 years ago

Peter Philipp wrote:

Terence Mill,

I've updated my already existing documentation.
I tried to get it as general as possible.
Could you review it?

Thanks
Peter

Thanks Peter, but that was i missunderstanding. I meant not "only" the doc for the webdav installation on (open)suse, but the whole redmine installation on (open)suse. I will review both in that kind i will do a full clean install based on your doc. We are running on debian at the moment, what works pretty good, but our IT resport wants SLES11 (what should be pretty same as opensuse) as OS. I also thinnk that having tested documentation for a redmine install on many OSes, the community can make a lot use of it.

Tx in adavance for your work!

RE: Webdav plugin - Added by Peter Philipp over 3 years ago

Terence Mill,

Unfortunately I didn't install Redmine. I've just added the webdav plugin to an existing installation. Thus I can't provide a qualified installation path for the base.

Cheers,
Peter

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

I'm excited by the potential of this plugin, but haven't managed to get it working. I'm using a Bitnami stack installation, and I think I have translated the appropriate bits to the proper locations. I'm running within an Apache VirtualHost at root, so have setup the webdav Location as /webdav. I'm running it in a test virtual machine and have pointed projects.local to it with my hosts file. It took me a while to work out that I had to include the line PerlLoadModule Apache::RedmineAdvanced prior to the VirtualHost definition, but now it loads and runs, but doesn't actually function.

First, here's the snippet from my Apache config:


<Location /webdav>
AuthType Basic
AuthName REDMINE
Require valid-user
PerlAccessHandler Apache::Authn::RedmineAdvanced::access_handler
PerlAuthenHandler Apache::Authn::RedmineAdvanced::authen_handler
RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost;mysql_socket=/opt/bitnami/mysql/tmp/mysql.sock"  
#RedmineDSN "DBI:mysql:database=bitnami_redmine;host=localhost" 
RedmineDbUser "bitnami" 
RedmineDbPass "(my correct password)" 
RedmineAuthenticationOnly "On" 
Order allow,deny
Allow from 127.0.0.1
Satisfy Any
</Location>

I got the RedmineDSN setting from a different thread on Subversion integration (which works for this install). I assume it's the same for this module. If I use the commented out setting without the mysql_socket information, I end up with a username/password prompt (from OSX Finder) when trying to connect, but a "Connection Failed" error and nothing showing in the production log. When I use the RedmineDSN as shown, I do not get a username/password prompt, just the "Connection Failed" error and this in the production log:
Processing WebdavController#rootwebdav (for 192.168.1.22 at 2010-10-25 00:39:04) [OPTIONS]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav"}
Redirected to http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fwebdav
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 4ms (DB: 1) | 302 Found [http://projects.local/webdav]

Processing AccountController#login (for 192.168.1.22 at 2010-10-25 00:39:04) [OPTIONS]
  Parameters: {"back_url"=>"http://projects.local/webdav", "action"=>"login", "controller"=>"account"}
Failed login for '' from 192.168.1.22 at Mon Oct 25 07:39:04 UTC 2010
Rendering template within layouts/base
Rendering account/login
Completed in 19ms (View: 15, DB: 2) | 200 OK [http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fwebdav]

Processing WebdavController#rootwebdav (for 192.168.1.22 at 2010-10-25 00:39:04) [OPTIONS]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav"}
Redirected to http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fwebdav
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 4ms (DB: 1) | 302 Found [http://projects.local/webdav/]

Processing AccountController#login (for 192.168.1.22 at 2010-10-25 00:39:04) [OPTIONS]
  Parameters: {"back_url"=>"http://projects.local/webdav", "action"=>"login", "controller"=>"account"}
Failed login for '' from 192.168.1.22 at Mon Oct 25 07:39:04 UTC 2010
Rendering template within layouts/base
Rendering account/login
Completed in 19ms (View: 15, DB: 1) | 200 OK [http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fwebdav]

This install requires authentication via the checkbox on the Admin > Settings > Authentication page. As an experiment, I just turned off that requirement and tried again with the same result, but received a different set of messages in the production log:

Processing WebdavController#rootwebdav (for 192.168.1.22 at 2010-10-25 00:40:26) [OPTIONS]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav"}
Settings cache cleared.
Completed in 8ms (View: 1, DB: 2) | 200 OK [http://projects.local/webdav]

Processing WebdavController#rootwebdav (for 192.168.1.22 at 2010-10-25 00:40:26) [OPTIONS]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav"}
Completed in 7ms (View: 1, DB: 1) | 200 OK [http://projects.local/webdav/]

Processing WebdavController#rootwebdav (for 192.168.1.22 at 2010-10-25 00:40:26) [PROPFIND]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav", "propfind"=>{"prop"=>{"getcontentlength"=>nil, "getlastmodified"=>nil, "resourcetype"=>nil}, "xmlns:D"=>"DAV:"}}

NoMethodError (undefined method `created_on' for nil:NilClass):

Rendering /opt/bitnami/apps/redmine/public/500.html (500 Internal Server Error)

Any ideas?

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Ian,

Did you install the redmine_http_auth plugin? And have you saved it's settings (in administration -> plugin) ?

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

Arnaud Martel wrote:

Did you install the redmine_http_auth plugin? And have you saved it's settings (in administration -> plugin) ?

Yes, it's installed and I had set "Enable HTTP Authentication" - however I suspect it's not actually working as I get no browser prompt when I sign out and click "Sign in via HTTP-Auth" - it just shows the typical HTML log in screen. I've Googled around for some help on this, but can't find any documentation beyond "load it, set the options and it works."

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Ian,

Strange... Your problems may come from the apache configuration, or from the redmine_http_auth plugin. I suggest to make the following tests:

  • First, exit your web browser (and close all browser's windows), then open your web browser and try to open http://projects.local/webdav => you should have the apache login window (if not, the require valid-user of your apache configuration is not working...). Try to log in with a wrong login/password => the login window should appear again. Enter a correct login/password and verify that the apache login window doesn't appear anymore (you may have a blank page or an apache error but it doesn't matter...).
    => If everything is OK, then we can say that your problem is not related to apache or RedmineAdvanced.pm
  • Second, change your apache configuration to replace
    <Location /webdav>

    with
    <Location />

    and try to open your redmine instance in your web browser. You should have the apache login windows and, after, you should be connected and identified in REDMINE (look top right, connected as...). If not, then redmine_http_auth is not working as designed and we'll have to focus on it...

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

Arnaud, thanks so much for your help!

Arnaud Martel wrote:

  • First, exit your web browser (and close all browser's windows), then open your web browser and try to open http://projects.local/webdav => you should have the apache login window (if not, the require valid-user of your apache configuration is not working...). Try to log in with a wrong login/password => the login window should appear again. Enter a correct login/password and verify that the apache login window doesn't appear anymore (you may have a blank page or an apache error but it doesn't matter...).
    => If everything is OK, then we can say that your problem is not related to apache or RedmineAdvanced.pm

(Using Google Chrome FYI) I closed fully out of the browser and opened http://projects.local/webdav and received a browser popup login prompt - I assume this is the apache login window. I tried a bad login/password and the window reappeared. I provided a correct login/password (admin account) and the login popup was replaced by the HTML login screen with the URL of http://projects.local/login?back_url=http://projects.local/webdav

  • Second, change your apache configuration to replace
    [...]
    with
    [...]
    and try to open your redmine instance in your web browser. You should have the apache login windows and, after, you should be connected and identified in REDMINE (look top right, connected as...). If not, then redmine_http_auth is not working as designed and we'll have to focus on it...

I changed the setting to "Location /" and restarted Apache, opened a new incognito window (should be the same as closing and reopening the browser) and received a login popup window. I provided a correct login/password and am shown the HTML login screen with the URL of http://projects.local/login?back_url=http://projects.local/httpauth-login

Here's the production log messages for that last action:

Processing WelcomeController#index (for 192.168.1.22 at 2010-10-26 09:55:34) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}
Redirected to http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fhttpauth-login
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 10ms (DB: 2) | 302 Found [http://projects.local/]

Processing AccountController#login (for 192.168.1.22 at 2010-10-26 09:55:34) [GET]
  Parameters: {"back_url"=>"http://projects.local/httpauth-login", "action"=>"login", "controller"=>"account"}
Rendering template within layouts/base
Rendering account/login
Completed in 82ms (View: 70, DB: 4) | 200 OK [http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2Fhttpauth-login]

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Ian,

OK. So it is related only to the redmine_http_auth plugin...
Could you replace it with mine to see if you still have trouble? (that's a very basic version focused only on the feature needed by the webdav plugin):
  • go in your redmine/vendor/plugins directory
  • rm -rf redmine_http_auth
  • tar xvzf redmine_http_auth.tgz
  • restart apache (or touch redmine/tmp/restart.txt if you use passenger. No plugin configuration...)

Arnaud

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

Arnaud,

I loaded your version of the http auth plugin, restarted both redmine and apache and verified the HTTP Auth plugin was shown differently on the plugins page (no config options available) then retried the above tests. The results were identical and the log messages from the first tests only differed in the timestamp. The very last test (change the Location to / and try again) had slightly different log messages - the "redirected to" link is different:


Processing WelcomeController#index (for 192.168.1.22 at 2010-10-28 21:28:48) [GET]
  Parameters: {"action"=>"index", "controller"=>"welcome"}
Redirected to http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2F
Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 9ms (DB: 1) | 302 Found [http://projects.local/]

Processing AccountController#login (for 192.168.1.22 at 2010-10-28 21:28:48) [GET]
  Parameters: {"back_url"=>"http://projects.local/", "action"=>"login", "controller"=>"account"}
Rendering template within layouts/base
Rendering account/login
Completed in 35ms (View: 28, DB: 4) | 200 OK [http://projects.local/login?back_url=http%3A%2F%2Fprojects.local%2F]

Thanks!
Ian.

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Ian,

OK. I think I found where is the problem: It seems that Bitnami is using apache + MONGREL to run rails application (I'm using phusion passenger...) and the REMOTE_USER variable may not be transfered from apache to MONGREL...
I found this post: http://rubyforge.org/pipermail/mongrel-users/2008-January/004952.html

hope it will work for you. If not, search google or ask on the bitnami forums (sorry, but I don't use bitnami and I don't know how applications are configured...)

Arnaud

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

THANK YOU! Good bit of detective work - nice Google-Fu! I'm new to Rails and didn't realize that Mongrel is atypical in an install.

That add to the apache configuration is not the only thing that must be done to get this to work - the http_auth plugin also needs to look for HTTP_REMOTE_USER.

I had to change the proxy directive to:

<Proxy balancer://rubystackcluster>
  # rewrite REMOTE_USER in a way that Mongrel can see it
  RewriteEngine On
  RewriteCond %{LA-U:REMOTE_USER} (.+)
  RewriteRule .* - [E=RU:%1]
  RequestHeader add REMOTE_USER %{RU}e

  BalancerMember http://127.0.0.1:3001
  BalancerMember http://127.0.0.1:3002
</Proxy>

Then I had to change the find_current_user_with_httpauth method in lib/http_auth_patch.rb to

    def find_current_user_with_httpauth
      if request.env['REMOTE_USER']
         user = try_login(request.env['REMOTE_USER'])
         return user if user
      elsif request.env['HTTP_REMOTE_USER']
         user = try_login(request.env['HTTP_REMOTE_USER'])
         return user if user
      end      
      #first proceed with redmine's version of finding current user
      find_current_user_without_httpauth
    end

Then it worked!

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

Now that it's working, I wonder if there may be a better way of handling the extra hidden files created by OSX. A simple method may be to just deny writing any filename that starts with a . which would catch .DS_Store and its ilk. I'm not sure if OSX would freak out if these writes are disallowed but the actual file write is.

A more thorough implementation may be to actually write those files but don't register them with Redmine so that they are available for retrieving from OSX but don't show through any other interface - properly hidden. Maybe write the files with the same unique-ish prefix of the file it's describing - if I'm accessing 10102812356_myfile.ext, then when writing .DS_Store, it gets saved a 101028123456_.DS_Store and the resource fork ends up as 101028123456_._myfile.ext, etc. Basically, any "hidden" files in that "folder" are written similarly. That way, all the little OSX file extras are preserved and shown properly to other OSX clients, but they are not visible when not requested. I believe that Windows has its own version of that and writes it as a file with the hidden bit set - thumbs.db for the thumbnail store on a folder containing pictures.

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Happy to see that everything is working now ;-)

I agree with you but the main reason for the macosx limitation is the use of the Webdav with a subversion repository... MacOSX doesn't update a file when to you want to replace it using the finder: the file is deleted first, then the new version is copied!!! So you loose the history of the file and... that's worth!!!
I'm using a mac and I spend a lot of time to try to resolve this HUGE problem but I didn't find any solution. That's why I implemented this option and I agree that it is not perfect...

About your first suggestion (havin a special management of hidden files), it doesn't work. I have tested this solution at the beginning and I noticed that MS Word didn't want to open .doc file in read/write (Word is doing a lot of things with hidden files, like read, then write, then read, etc... and if something's wrong then the .doc file is opened only for read...)

Last thing about Webdav and macosx: that's slow, much slower than Windows and Linux...

Arnaud,

RE: Webdav plugin - Added by Ian Epperson over 3 years ago

Not a great solution, but have you tried turning off the .DS_Store creation:
http://hints.macworld.com/article.php?story=2005070300463515

To prevent the creation of these files, open the Terminal and type:

 defaults write com.apple.desktopservices DSDontWriteNetworkStores true

It's at least a stop-gap.

RE: Webdav plugin - Added by Sergei Korobochkin over 3 years ago

Please help me solve this error "Railsdav::UnknownWebDavMethodError (Railsdav::UnknownWebDavMethodError):"
redmine 1.02 (Modificated)
ubuntu 10.04 + apache2 + passenger + rails 2.3.5 + redmine_webdav (trunk)

user authentication is working, but when the page opens 192.168.3.128/redmine/webdav
I get an error

Processing WebdavController#rootwebdav (for 192.168.3.128 at 2010-12-14 15:02:06) [GET]
  Parameters: {"action"=>"rootwebdav", "controller"=>"webdav"}

Railsdav::UnknownWebDavMethodError (Railsdav::UnknownWebDavMethodError):
  /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:95:in `process_request'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:374:in `start_request_handler'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:330:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:209:in `start'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
  /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  /usr/lib/phusion_passenger/passenger-spawn-server:61

Rendering /usr/share/redmine_work/public/500.html (500 Internal Server Error)

my config

/etc/apache2/conf.d/redmine_webdav.conf

root@redmine:/etc/apache2/conf.d# vim redmine_webdav.conf
PerlLoadModule Apache2::Authn::RedmineAdvanced
<Location /redmine/webdav>
    AuthType Basic
    AuthName REDMINE
    Require valid-user
    PerlAccessHandler Apache::Authn::RedmineAdvanced::access_handler
    PerlAuthenHandler Apache::Authn::RedmineAdvanced::authen_handler
    RedmineDSN "DBI:mysql:database=redmine;host=localhost;port=3306" 
    RedmineDbUser "root" 
    RedmineDbPass "..." 
    RedmineAuthenticationOnly "On" 
    Order allow,deny
    Allow from 127.0.0.1
    Satisfy Any
</Location>

swears by this line in webdav_controller.rb

 acts_as_webdav :resource_model => Webdav

RE: Webdav plugin - Added by Arnaud Martel over 3 years ago

Sergei,

I think you are not using a WebDAV client to access http://192.168.3.128/redmine/webdav.
The WebDAV plugin is not designed to support requests from a web browser (a true WebDAV client sends a PROPFIND method, not GET) and I think that's why you have a Railsdav::UnknownWebDavMethodError error...

I don't kown what OS are you using but look at https://github.com/amartel/redmine_webdav (7. Use webdav to manage files and documents) to see how to configure a webdav client.

Kind regards,
Arnaud

RE: Webdav plugin - Added by Sergei Korobochkin over 3 years ago

my goodness
I spent almost a week to solve this problem Mozilla browsing firefox
After connecting through the client webdav it work!
many thanks comrade!

1 2 3 4 (1-25/90)