Coder Social home page Coder Social logo

Comments (3)

pzystorm avatar pzystorm commented on May 28, 2024

I have the same problem.

Traceback (most recent call last):
  File "./export.py", line 11, in <module>
    archiver.archive_room(room_id)
  File "/usr/local/lib/python3.6/dist-packages/webexteamsarchiver/webexteamsarchiver.py", line 165, in archive_room
    self._gather_room_information(room_id, download_avatars)
  File "/usr/local/lib/python3.6/dist-packages/webexteamsarchiver/webexteamsarchiver.py", line 302, in _gather_room_information
    self._organize_by_threads(self.messages, download_avatars)
  File "/usr/local/lib/python3.6/dist-packages/webexteamsarchiver/webexteamsarchiver.py", line 349, in _organize_by_threads
    file_metadata = self.file_details(url)
  File "/usr/local/lib/python3.6/dist-packages/webexteamsarchiver/webexteamsarchiver.py", line 106, in file_details
    raise MalformedResponse(message)
webexteamssdk.exceptions.MalformedResponse: Failed to find filename='' in attachment; filename="" for url https://webexapis.com/v1/contents/Y2lzY29zcGFyazovL....................tNDExZjg2MTQ0Yzg5LzA

When looking at the headers for that file:

HTTP/2 200
date: Wed, 17 Mar 2021 01:31:44 GMT
content-type: text/plain
content-length: 115732
cache-control: no-cache, no-store
via: 1.1 linkerd
trackingid: ROUTER_60.......2803BA
server: Redacted
content-disposition: attachment; filename=""
vary: accept-encoding
strict-transport-security: max-age=63072000; includeSubDomains; preload

so there is really no filename... how can that be?.. and is there a workaround?

from webex-teams-archiver.

pzystorm avatar pzystorm commented on May 28, 2024

FYI, I have changed this if clause:

if not filename_re:
message = (
f"Failed to find filename='' in {r.headers.get('Content-Disposition', '')} for url {url}"
)
raise MalformedResponse(message)

to this block:

            if not filename_re:
                newfilename = re.sub(r'^.+/([^/]+)$', r'\1', url)
                message = (
                    f"Set filename to '{newfilename}' in {r.headers.get('Content-Disposition', '')} for url {url}"
                )
                logger.debug(message)
                filename_re = re.search(r"filename=\"(.+?)\"", f"filename=\"{newfilename}\"", re.I)
                #raise MalformedResponse(message)

That will set the filename to the last part of the URL.
Means: the URL of the attachment is maybe something like this:
https://webexapis.com/v1/contents/Y2lzY29zcGFyazovL3VzL0NPTlRFTlQvYTM1N2foobarasdf
And if then there is no original filename information in the content-disposition header like I describe in my posting above, then the file will be saved as "Y2lzY29zcGFyazovL3VzL0NPTlRFTlQvYTM1N2foobarasdf"

Works like a charm for me.

from webex-teams-archiver.

fdemello avatar fdemello commented on May 28, 2024

@pzystorm thanks! I've released v0.11.1 with your suggestion.

from webex-teams-archiver.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.