Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Duplicated folder. Gmail isn't case sensitive. #45

Open
carloscabanero opened this issue Sep 6, 2011 · 1 comment
Open

Duplicated folder. Gmail isn't case sensitive. #45

carloscabanero opened this issue Sep 6, 2011 · 1 comment

Comments

@carloscabanero
Copy link

This issue happens whenever you have a folder with the same name but different casing between source and destination (ie. "folder" - "Folder"). IMAP protocol is case sensitive, but gmail isn't and throws a fatal error that stops the migration.

I coded a simple patch that adds a new quirk, that checks a regexp for the name.

def mailbox(name, delim = '/')
    retries = 0

    name.gsub!(/^(inbox\/?)/i){ $1.upcase }
    name.gsub!(delim, self.delim)

    name.gsub!(/\s+/, ' ') if @quirks[:gmail]

    # Gmail doesn't allow folders with leading or trailing whitespace.                                                                                       \

    name.strip! if @quirks[:gmail]

    begin
      if @quirks[:gmail]
        # In Gmail folders are not case sensitive                                                                                                             
        update_mailboxes
        @mailboxes.keys.each do |key|
          if key =~ /^#{Regexp.quote(name)}$/i
            return @mailboxes[key]
          end
        end
        raise MailboxNotFoundError, "mailbox not found: #{name}"
      end

      @mailboxes.fetch(name) do
        update_mailboxes
[....]
@rgrove
Copy link
Owner

rgrove commented Sep 7, 2011

Good catch. Would you mind sending a pull request with your patch?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants