Deleted folder (still in trash) results in errors while accessing parent folder via webdav #404

This commit is contained in:
Karel Pičman 2015-07-13 12:35:39 +02:00
parent fd49d68874
commit 294e39836c
4 changed files with 12 additions and 8 deletions

View File

@ -67,8 +67,8 @@ module RedmineDmsf
module InstanceMethods
def dmsf_count
file_count = self.dmsf_files.visible.count + self.file_links.count
folder_count = self.dmsf_folders.visible.count + self.folder_links.count
file_count = self.dmsf_files.visible.count + self.file_links.visible.count
folder_count = self.dmsf_folders.visible.count + self.folder_links.visible.count
self.dmsf_folders.visible.each do |f|
file_count += f.deep_file_count
folder_count += f.deep_folder_count

View File

@ -1,7 +1,9 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License

View File

@ -54,7 +54,7 @@ module RedmineDmsf
return @children if @children
@children = []
return [] unless collection?
folder.subfolders.map do |p|
folder.subfolders.visible.map do |p|
@children.push child(p.title)
end
folder.files.visible.map do |p|
@ -81,13 +81,13 @@ module RedmineDmsf
# Todo: Move folder data retrieval into folder function, and use folder method to determine existence
def folder
return @folder unless @folder == false
return nil if project.nil? || project.id.nil? #if the project doesnt exist, this entity can't exist
return nil if project.nil? || project.id.nil? #if the project doesn't exist, this entity can't exist
@folder = nil
# Note: Folder is searched for as a generic search to prevent SQL queries being generated:
# if we were to look within parent, we'd have to go all the way up the chain as part of the
# existence check, and although I'm sure we'd love to access the heirarchy, I can't yet
# existence check, and although I'm sure we'd love to access the hierarchy, I can't yet
# see a practical need for it
folders = DmsfFolder.visible.where(:project_id => project.id, :title => basename).order('title ASC').all
folders = DmsfFolder.visible.where(:project_id => project.id, :title => basename).order('title ASC').to_a
return nil unless folders.length > 0
if (folders.length > 1) then
folders.delete_if { |x| '/' + x.dmsf_path_str != projectless_path }

View File

@ -1,7 +1,9 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License