|
a/Allura/allura/app.py |
|
b/Allura/allura/app.py |
|
... |
|
... |
225 |
parent_id = in_reply_to[0]
|
225 |
parent_id = in_reply_to[0]
|
226 |
else:
|
226 |
else:
|
227 |
parent_id = None
|
227 |
parent_id = None
|
228 |
thd = artifact.get_discussion_thread(data)
|
228 |
thd = artifact.get_discussion_thread(data)
|
229 |
# Handle attachments
|
229 |
# Handle attachments
|
230 |
message_id = data['message_id'][0]
|
230 |
message_id = data['message_id']
|
231 |
if data.get('filename'):
|
231 |
if data.get('filename'):
|
232 |
# Special case - the actual post may not have been created yet
|
232 |
# Special case - the actual post may not have been created yet
|
233 |
log.info('Saving attachment %s', data['filename'])
|
233 |
log.info('Saving attachment %s', data['filename'])
|
234 |
fp = StringIO(data['payload'])
|
234 |
fp = StringIO(data['payload'])
|
235 |
self.AttachmentClass.save_attachment(
|
235 |
self.AttachmentClass.save_attachment(
|
236 |
data['filename'], fp,
|
236 |
data['filename'], fp,
|
237 |
content_type=data.get('content_type', 'application/octet-stream'),
|
237 |
content_type=data.get('content_type', 'application/octet-stream'),
|
238 |
discussion_id=self.config.discussion_id,
|
238 |
discussion_id=thd.discussion_id,
|
239 |
thread_id=thd._id,
|
239 |
thread_id=thd._id,
|
240 |
post_id=message_id,
|
240 |
post_id=message_id,
|
241 |
artifact_id=message_id)
|
241 |
artifact_id=message_id)
|
242 |
return
|
242 |
return
|
243 |
# Handle duplicates
|
243 |
# Handle duplicates
|
|
... |
|
... |
246 |
log.info('Existing message_id %s found - saving this as text attachment' % message_id)
|
246 |
log.info('Existing message_id %s found - saving this as text attachment' % message_id)
|
247 |
fp = StringIO(data['payload'])
|
247 |
fp = StringIO(data['payload'])
|
248 |
post.attach(
|
248 |
post.attach(
|
249 |
'alternate', fp,
|
249 |
'alternate', fp,
|
250 |
content_type=data.get('content_type', 'application/octet-stream'),
|
250 |
content_type=data.get('content_type', 'application/octet-stream'),
|
251 |
discussion_id=self.config.discussion_id,
|
251 |
discussion_id=thd.discussion_id,
|
252 |
thread_id=thd._id,
|
252 |
thread_id=thd._id,
|
253 |
post_id=message_id)
|
253 |
post_id=message_id)
|
254 |
else:
|
254 |
else:
|
255 |
post = thd.post(
|
255 |
post = thd.post(
|
256 |
text=data['payload'] or '--no text body--',
|
256 |
text=data['payload'] or '--no text body--',
|