You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: webdav.go
    path of file: ./repos/Cloudreve/pkg/webdav
    
    the code of the file until where you have to start completion: // Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package webdav provides a WebDAV server implementation.
package webdav // import "golang.org/x/net/webdav"

import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"net/http/httputil"
	"net/url"
	"path"
	"strconv"
	"strings"
	"sync"
	"time"

	model "github.com/cloudreve/Cloudreve/v3/models"
	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem"
	"github.com/cloudreve/Cloudreve/v3/pkg/filesystem/fsctx"
	"github.com/cloudreve/Cloudreve/v3/pkg/util"
)

type 
    
func (h *Handler) handleDelete(w http.ResponseWriter, r *http.Request, fs *filesystem.FileSystem) (status int, err error) {
	defer fs.Recycle()

	reqPath, status, err := h.stripPrefix(r.URL.Path, fs.User.ID)
	if err != nil {
		return status, err
	}

	release, status, err := h.confirmLocks(r, reqPath, "", fs)
	if err != nil {
		return status, err
	}
	defer release()

	ctx := r.Context()

	// 尝试作为文件删除
	if ok, file := fs.IsFileExist(reqPath); ok {
		if err := fs.Delete(ctx, []uint{}, []uint{file.ID}, false, false); err != nil {
			return http.StatusMethodNotAllowed, err
		}
		return http.StatusNoContent, nil
	}

	// 尝试作为目录删除
	if ok, folder := fs.IsPathExist(reqPath); ok {
		if err := fs.Delete(ctx, []uint{folder.ID}, []uint{}, false, false); err != nil {
			return http.StatusMethodNotAllowed, err
		}
		return http.StatusNoContent, nil
	}

	return http.StatusNotFound, nil
}