lib/fastdfs-client/storage.rb in fastdfs-client-0.0.2 vs lib/fastdfs-client/storage.rb in fastdfs-client-0.0.3
- old
+ new
@@ -29,17 +29,17 @@
def delete(path, group_name = nil)
cmd = CMD::DELETE_FILE
raise "path arguments is empty!" if path.blank?
if group_name.blank?
group_name = /^\/?(\w+)/.match(path)[1]
- path = path.gsub("/#{group_name}")
+ path = path.gsub(Regexp.new("/?#{group_name}/?"), "")
end
raise "group_name arguments is empty!" if group_name.blank?
group_bytes = group_name.bytes.fill(0, group_name.length...ProtoCommon::GROUP_NAME_MAX_LEN)
path_length = (group_bytes.length + path.bytes.length)
@socket.write(cmd, (ProtoCommon.header_bytes(cmd, path_length) + group_bytes + path.bytes))
- @socket.receive
+ @socket.receive{ true }
end
private
def _upload(file)
cmd = CMD::UPLOAD_FILE
\ No newline at end of file