I have a content type with a filefield, and i´ve enabled module diff to show diferences between revisions.

The problem is that when i change de filelield a new revision is created but when i push the button to show diffs it's says that there is no difference between the two revision.

whats happening


#3 filefield_diff.patch814 bytesquicksketch
Members fund testing for the Drupal project. Drupal Association Learn more


quicksketch’s picture

Title: diff doesn´t work with filefield » Add Comparison Support for Diff Module

I haven't tried using diff with FileField, but it doesn't surprise me it doesn't work out-of-box. CCK currently is providing all the diff functionality for FileField, using the default comparison function. This comparison checks for a "value" property, but FileField doesn't actually have a value property, it uses a file "fid" as the primary value.

It looks like FileField can implement hook_content_diff_values() to solve this problem, I'm moving this to a feature request.

quicksketch’s picture

Category: support » feature
quicksketch’s picture

Status: Active » Needs review
814 bytes

This patch adds basic Diff support, comparing the upload file paths. It doesn't take into consideration Alt, Title, or Description texts, I'm not sure if they'd be appropriate to include (Diff's upload.module support doesn't support descriptions either).

infodrupal’s picture

I've tried the patch and i think it works.

I've made some changes because i'm interested only in the filename. The code is as follows:

function filefield_content_diff_values($node, $field, $items) {
$return = array();
foreach ($items as $item) {
if (is_array($item) && !empty($item['filepath'])) {
$file = basename($item['filepath']);
$filename = explode(".",$file);
$return[] = $filename[0];
return $return;

I think this is a beginning because it would be fantastic if the module could show other differences like description, name or timestamp.

Encarte’s picture


Agileware’s picture

Status: Needs review » Reviewed & tested by the community

Patch #3 works for me and would be a great addition to FileField.

quicksketch’s picture

Version: 6.x-3.0 » 6.x-3.2
Status: Reviewed & tested by the community » Fixed

Well basic support is better than no support. Committed #3.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.