old_contents: import os
  
  from django.conf import settings
  
  from filemanager.settings import DIRECTORY
  
  
  class Filemanager(object):
      def __init__(self, path=None):
          self.update_path(path)
  
      def update_path(self, path):
          if path is None or len(path) == 0:
              self.path = ''
              self.abspath = DIRECTORY
          else:
              self.path = self.validate_path(path)
              self.abspath = os.path.join(DIRECTORY, self.path)
          self.location = os.path.join(settings.MEDIA_ROOT, self.abspath)
          self.url = os.path.join(settings.MEDIA_URL, self.abspath)
  
      def validate_path(self, path):
          # replace backslash with slash
          path = path.replace('\\', '/')
          # remove leading and trailing slashes
          path = '/'.join([i for i in path.split('/') if i])
  
          return path
  
      def get_breadcrumbs(self):
          breadcrumbs = [{
              'label': 'Filemanager',
              'path': '',
          }]
  
          parts = self.path.split('/')
  
          path = ''
          for part in parts:
              path = os.path.join(path, part)
              breadcrumbs.append({
                  'label': part,
                  'path': path,
              })
  
          return breadcrumbs
  
new_contents: import os
  
  from django.conf import settings
  
  from filemanager.settings import DIRECTORY
  
  
  class Filemanager(object):
      def __init__(self, path=None):
          self.update_path(path)
  
      def update_path(self, path):
          if path is None or len(path) == 0:
              self.path = ''
              self.abspath = DIRECTORY
          else:
              self.path = self.validate_path(path)
              self.abspath = os.path.join(DIRECTORY, self.path)
          self.location = os.path.join(settings.MEDIA_ROOT, self.abspath)
          self.url = os.path.join(settings.MEDIA_URL, self.abspath)
  
      def validate_path(self, path):
          # replace backslash with slash
          path = path.replace('\\', '/')
          # remove leading and trailing slashes
          path = '/'.join([i for i in path.split('/') if i])
  
          return path
  
      def get_breadcrumbs(self):
          breadcrumbs = [{
              'label': 'Filemanager',
              'path': '',
          }]
  
          parts = [e for e in self.path.split('/') if e]
  
          path = ''
          for part in parts:
              path = os.path.join(path, part)
              breadcrumbs.append({
                  'label': part,
                  'path': path,
              })
  
          return breadcrumbs
  
subject: fix dropping of empty values in breadrumbs generation